docs: fix revision number not matching template#433
Merged
gauteroenning merged 1 commit intoMay 8, 2026
Conversation
Collaborator
gauteroenning
commented
May 8, 2026
- fix document number template preview for major-minor format
- fix the same logic for part number in the organization revision utils helpers
- fix document number template preview for major-minor format - fix the same logic for part number in the organization revision utils helpers Signed-off-by: gauteronning <gaute.ronning@optoscale.no>
Collaborator
Author
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the revision templating/preview pipeline so that templates using the <revision> placeholder correctly reflect the organization’s configured revision format (major-only vs major-minor), and ensures document formatted revisions can use document-specific revision format settings.
Changes:
- Pass
revision_formatthrough the template preview endpoints and admin UI preview requests. - Update revision template rendering to generate a combined
<revision>value for major-minor (e.g.,A-0/1-0) instead of always using only the major component. - Override
build_formatted_revisionbehavior for documents so it can usedocument_revision_format.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| dokuly/organizations/views.py | Adds revision_format to request parsing and passes it into preview formatting helpers. |
| dokuly/organizations/revision_utils.py | Adds revision_format support when replacing <revision> and allows callers to override revision format in build_formatted_revision. |
| dokuly/frontend/src/components/admin/adminComponents/general/revisionSystemSettings.js | Sends revision_format to backend previews and refactors UI rendering/wording around revision settings and template previews. |
| dokuly/frontend/src/components/admin/adminComponents/documents/documentNumberSettings.js | Sends revision_format when requesting document number template previews. |
| dokuly/documents/views.py | Fetches document_revision_format and passes it into build_formatted_revision for document creation and revisioning. |
Comments suppressed due to low confidence (1)
dokuly/organizations/revision_utils.py:170
build_formatted_revision’s docstring/examples still describe building a full part number and even referencebuild_full_part_number(...). Since this function is specifically for the formatted revision string (and now acceptsrevision_formatoverrides), please update the docstring so it accurately documents the behavior and parameters.
"""
Build a full part number using organization settings and template.
This is a convenience wrapper around build_full_part_number_from_template
that automatically fetches the organization's template and revision settings.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| }, | ||
| { | ||
| keyword: "<revision>", | ||
| description: "Major Revision (A, B, C or 0, 1, 2)", |
Comment on lines
+321
to
+326
| : useNumberRevisions | ||
| ? revisionStartAtOne | ||
| ? "Major-Minor (1-0, 1-1, 2-0...)" | ||
| : "Major-Minor (0-0, 0-1, 1-0...)" | ||
| : "Major-Minor (A-A, A-B, B-A...)" | ||
| } |
Comment on lines
+235
to
+239
| try: | ||
| _org = OrgModel.objects.get(id=organization_id) | ||
| doc_revision_format = _org.document_revision_format | ||
| except Exception: | ||
| doc_revision_format = "major-only" |
Comment on lines
+1007
to
+1011
| try: | ||
| _org = OrgModel.objects.get(id=organization_id) | ||
| doc_revision_format = _org.document_revision_format | ||
| except Exception: | ||
| doc_revision_format = "major-only" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

