Skip to content

[16.0][IMP] agx_sarabun: add allow_manual flag and constraint on document type - #1182

Open
n3n wants to merge 2 commits into
16.0from
16.0-imp-agx_sarabun-doc-type-manual-create
Open

[16.0][IMP] agx_sarabun: add allow_manual flag and constraint on document type#1182
n3n wants to merge 2 commits into
16.0from
16.0-imp-agx_sarabun-doc-type-manual-create

Conversation

@n3n

@n3n n3n commented Aug 22, 2026

Copy link
Copy Markdown
Member

Summary

  • Add allow_manual (stored computed, admin-overridable Boolean) to sarabun.document.type — defaults False for from_record kinds, True for memo/circular
  • Gate the manual-create type dropdown (domain on type_id) so only manual-creatable types appear when composing by hand
  • Add server-side constraint _check_manual_creation_allowed that rejects origin-less หนังสือ whose type has allow_manual=False, closing RPC/import back doors
  • Fix test helper default type from from_recordmemo (safe for origin-less calls) and expose doc_type_from_record for tests that need it; add 5 new tests covering the field and constraint
  • Bump version 16.0.5.0.016.0.6.0.0

Test plan

  • oca_run_tests on agx_sarabun, agx_sarabun_reset, agx_sarabun_todo
  • Verify allow_manual column visible in Document Types tree/form
  • Confirm from_record types are hidden from the manual-create type dropdown on the หนังสือ form

@n3n
n3n force-pushed the 16.0-imp-agx_sarabun-doc-type-manual-create branch 2 times, most recently from 21e2350 to 73312c6 Compare August 22, 2026 15:10
…type

Add `allow_manual` (stored computed, overridable) to `sarabun.document.type`
that defaults False for `from_record` kinds and True for `memo`/`circular`.
Gate the manual-create type dropdown on this flag and enforce it server-side
via `_check_manual_creation_allowed` so origin-less from_record หนังสือ are
refused even through RPC/import. Fix test helper default type to memo (safe
for origin-less calls) and add coverage for the new field and constraint.
@n3n
n3n force-pushed the 16.0-imp-agx_sarabun-doc-type-manual-create branch from 73312c6 to c0b1afd Compare September 7, 2026 15:29
A หนังสือ whose type is not manual-creatable (`allow_manual=False`) is spawned
with its classification and must keep it, so make ประเภทเอกสาร read-only on the
form once such a type is set. Adds `type_allow_manual` (related to
`type_id.allow_manual`) to back the readonly attrs; the `type_id != False` guard
keeps the field editable on a new record, where the required type has yet to be
picked.
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