Skip to content

[16.0][IMP] agx_sarabun: OU-scoped route templates + type-bound origin model - #1216

Open
n3n wants to merge 4 commits into
16.0from
16.0-imp-agx_sarabun-route-template-ou-domain
Open

[16.0][IMP] agx_sarabun: OU-scoped route templates + type-bound origin model#1216
n3n wants to merge 4 commits into
16.0from
16.0-imp-agx_sarabun-route-template-ou-domain

Conversation

@n3n

@n3n n3n commented Aug 26, 2026

Copy link
Copy Markdown
Member

Summary

  • Route template matching for a document's ผู้ส่ง now scopes by master department (ส่วนงาน) via the core hr.department.master_department_id, instead of the sender's immediate sub-unit — units under the same faculty now see each other's templates.
  • Adds an optional origin_model_id on sarabun.document.type (meaningful only for kind = 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.
  • Removes the now-redundant plain-text fallback for condition_domain on route templates, since a type-bound template always resolves its origin model.

Test plan

  • oca_run_tests (or agx_sarabun post_install tags) — 4 new cases plus existing 7 test files
  • -u agx_sarabun upgrade on a dev/runbot DB (additive fields only, no migration needed)
  • UAT: create a from_record type 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

n3n added 2 commits August 28, 2026 00:53
…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
n3n force-pushed the 16.0-imp-agx_sarabun-route-template-ou-domain branch from a90b19a to 66db256 Compare August 27, 2026 17:54
n3n added 2 commits August 28, 2026 12:11
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().
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant