Skip to content

docs: fix revision number not matching template#433

Merged
gauteroenning merged 1 commit into
masterfrom
430-document-numbering-not-matching-template
May 8, 2026
Merged

docs: fix revision number not matching template#433
gauteroenning merged 1 commit into
masterfrom
430-document-numbering-not-matching-template

Conversation

@gauteroenning
Copy link
Copy Markdown
Collaborator

  • 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>
@gauteroenning gauteroenning linked an issue May 8, 2026 that may be closed by this pull request
@gauteroenning
Copy link
Copy Markdown
Collaborator Author

gauteroenning commented May 8, 2026

New revision after changing from letter based revisions to numbers on an existing document:
image

Document number template preview fix:
image

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_format through 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_revision behavior for documents so it can use document_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 reference build_full_part_number(...). Since this function is specifically for the formatted revision string (and now accepts revision_format overrides), 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 thread dokuly/documents/views.py
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 thread dokuly/documents/views.py
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"
@gauteroenning gauteroenning added this pull request to the merge queue May 8, 2026
Merged via the queue into master with commit eccad32 May 8, 2026
6 checks passed
@gauteroenning gauteroenning deleted the 430-document-numbering-not-matching-template branch May 8, 2026 13:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Document numbering not matching template

2 participants