[16.0][IMP] agx_sarabun: OU-scoped route templates + type-bound origin model - #1216
Open
n3n wants to merge 4 commits into
Open
[16.0][IMP] agx_sarabun: OU-scoped route templates + type-bound origin model#1216n3n wants to merge 4 commits into
n3n wants to merge 4 commits into
Conversation
…n model Fix route template domain to scope by master department (ส่วนงาน) instead of the sender's sub-unit, so units under the same faculty share templates. Add an optional origin_model_id on sarabun.document.type so a document type can pin its source system; route templates and documents that use that type are now validated to match it, and the template auto-fills its origin model from the type.
…sfer Use the new sarabun.document.type.origin_model_id so the ขออนุมัติโอนงบประมาณ type is validated against budget.transfer, matching the route template's already-set origin_model.
n3n
force-pushed
the
16.0-imp-agx_sarabun-route-template-ou-domain
branch
from
August 27, 2026 17:54
a90b19a to
66db256
Compare
Picking a route template on a draft/returned หนังสือ now clears the living route and seeds it from the template right away, instead of requiring a separate "โหลดเส้นทางจากแม่แบบ" click. The button stays for reloading the same template after its lines change elsewhere.
…teps early .unlink() called imperatively inside the route_template_id onchange resolved NewId-wrapped routing steps back to their real database ids (origin_ids()) and deleted them immediately, before Save/Discard ever ran — so re-picking the same template wiped live steps and later lookups hit MissingError. Replace it with a single field assignment combining removal and re-seed commands, which onchange safely defers until an actual write().
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
hr.department.master_department_id, instead of the sender's immediate sub-unit — units under the same faculty now see each other's templates.origin_model_idonsarabun.document.type(meaningful only forkind = from_record) so a type can pin its source system; route templates bound to that type auto-fill and are validated against it, and documents using that type are validated too.condition_domainon route templates, since a type-bound template always resolves its origin model.Test plan
oca_run_tests(oragx_sarabunpost_install tags) — 4 new cases plus existing 7 test files-u agx_sarabunupgrade on a dev/runbot DB (additive fields only, no migration needed)from_recordtype bound to a model, confirm route template auto-fills + becomes readonly, and confirm a user in a sub-unit sees templates scoped to the whole faculty