[16.0][IMP] agx_approval: mint number at submit, use AR/<be>/#### format - #1217
Merged
Merged
Conversation
n3n
requested changes
Aug 27, 2026
PiyaChaiyanit
pushed a commit
that referenced
this pull request
Aug 28, 2026
Address review feedback on PR #1217: - Restore data/approval_sequence.xml as a single ir.sequence with prefix="AR/%(year_be)s/" and use_date_range=1; Odoo auto-creates the per-fiscal-year sub-sequences (drops the hand-coded Sequence.create helper in the model). - Add l10n_th_base_sequence to depends (formalizes the %(year_be)s interpolation source, matching procurement_plan/__manifest__.py). - name field default switches from "/" to _("New"), aligning with the procurement_plan / kmitl_project house pattern. - action_to_verify calls next_by_code with ir_sequence_date + sequence_date pinned to account_fiscal_year_id.date_to, mirroring procurement_plan.action_send_to_verify. Guard accepts "/" alongside _("New") so pre-PR drafts still get numbered on first submit. - View readonly clause on account_fiscal_year_id switches from state != draft to name != "New" per reviewer request.
PiyaChaiyanit
pushed a commit
that referenced
this pull request
Aug 28, 2026
Address review feedback on PR #1217: - Restore data/approval_sequence.xml as a single ir.sequence with prefix="AR/%(year_be)s/" and use_date_range=1; Odoo auto-creates the per-fiscal-year sub-sequences (drops the hand-coded Sequence.create helper in the model). - Add l10n_th_base_sequence to depends (formalizes the %(year_be)s interpolation source, matching procurement_plan/__manifest__.py). - name field default switches from "/" to _("New"), aligning with the procurement_plan / kmitl_project house pattern. - action_to_verify calls next_by_code with ir_sequence_date + sequence_date pinned to account_fiscal_year_id.date_to, mirroring procurement_plan.action_send_to_verify. Guard accepts "/" alongside _("New") so pre-PR drafts still get numbered on first submit. - View readonly clause on account_fiscal_year_id switches from state != draft to name != "New" per reviewer request.
PiyaChaiyanit
force-pushed
the
16.0-imp-approval_request-sequence
branch
from
August 28, 2026 07:21
44f497a to
58c71ab
Compare
n3n
approved these changes
Aug 29, 2026
added 3 commits
August 31, 2026 10:16
…format - Move number allocation from create() to action_to_verify(): drafts stay "/" until the user actually submits, so unsent drafts no longer burn a running counter. - Reformat the official number as AR/<be-year>/#### using a per-fiscal-year ir.sequence created on demand (Buddhist year derived from account_fiscal_year_id.date_to.year + 543). - Lock account_fiscal_year_id once the request is numbered: view attrs go readonly outside draft, and a server-side @api.constrains blocks RPC changes when name != "/". - Drop the now-unused flat approval_sequence.xml data record.
Address review feedback on PR #1217: - Restore data/approval_sequence.xml as a single ir.sequence with prefix="AR/%(year_be)s/" and use_date_range=1; Odoo auto-creates the per-fiscal-year sub-sequences (drops the hand-coded Sequence.create helper in the model). - Add l10n_th_base_sequence to depends (formalizes the %(year_be)s interpolation source, matching procurement_plan/__manifest__.py). - name field default switches from "/" to _("New"), aligning with the procurement_plan / kmitl_project house pattern. - action_to_verify calls next_by_code with ir_sequence_date + sequence_date pinned to account_fiscal_year_id.date_to, mirroring procurement_plan.action_send_to_verify. Guard accepts "/" alongside _("New") so pre-PR drafts still get numbered on first submit. - View readonly clause on account_fiscal_year_id switches from state != draft to name != "New" per reviewer request.
- Add computed is_number_assigned = bool(name and name not in ("/",
_("New"))). The FY view attrs, action_to_verify guard, and constraint
now all consult this flag instead of comparing name against a hard-
coded English "New", so records created in Thai locale (name stored as
"รายการใหม่") are treated as unnumbered until action_to_verify.
- Translate _("New") → "รายการใหม่" in th.po.
PiyaChaiyanit
force-pushed
the
16.0-imp-approval_request-sequence
branch
from
August 31, 2026 03:17
f095f3e to
e8c935b
Compare
…t number
The number is minted at submit, so the placeholder persists in the DB and is
read back by users in other locales. A translated default (_("New")) would
compare unequal to _() evaluated in the reader's language: a th_TH draft stored
"รายการใหม่" would look already-numbered to an en_US user, skipping the mint and
freezing the fiscal year on an unnumbered request.
Follow account.move: store the untranslated "/" sentinel and render the friendly
label in the form view, where it is translated per reader at render time.
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.
Summary
approval.requestnumber allocation fromcreate()toaction_to_verify()so unsent drafts stay/and no longer burn a running counter.AR/<be-year>/####using per-fiscal-yearir.sequencerecords created on demand (Buddhist year =account_fiscal_year_id.date_to.year + 543), so the counter resets each ปีงบประมาณ.account_fiscal_year_idonce the request is numbered — view attrs go readonly outsidedraft, and a server-side@api.constrainsblocks RPC bypasses. The now-unused flatapproval_sequence.xmlis removed.Test plan
namestays/, noir.sequencetick.namebecomesAR/<be>/0001for the selected FY.nameunchanged.account_fiscal_year_idafter submission → view field is readonly and RPCwriteraisesValidationError.