Skip to content

[16.0][FIX] disbursement_finance_kmitl: unblock navigation at bills_posted when payment subject is empty - #1260

Merged
coreichamp merged 1 commit into
16.0from
coreichamp/16.0-fix-disbursement_finance_kmitl-audit-subject-required
Sep 8, 2026
Merged

[16.0][FIX] disbursement_finance_kmitl: unblock navigation at bills_posted when payment subject is empty#1260
coreichamp merged 1 commit into
16.0from
coreichamp/16.0-fix-disbursement_finance_kmitl-audit-subject-required

Conversation

@coreichamp

Copy link
Copy Markdown
Contributor

Summary

  • payment_subject_id (เรื่องที่จ่าย) was required in the view exactly at bills_posted, the one state every request arrives at with the field empty (the accounting bridge writes that state; choosing the subject is the auditor's own first job).
  • Every type="object" button (header buttons and smart buttons alike) saves and validates the whole form regardless of whether it's dirty, so the auditor's smart buttons (ใบตั้งหนี้ / payments / journal entries / sarabun) were blocked on an untouched form — locking the auditor out of the very documents they need to decide the subject.
  • The requirement is already enforced server-side by _check_payment_classification, the only transition that consumes it (action_audit, action_audit_batch, _create_payments), with its own translated UserError and existing test coverage (test_audit_needs_a_subject).
  • Dropped the view-level required (kept readonly), and replaced the lost asterisk with a non-blocking warning banner on the Payment Execution page reusing the exact guard message, so the translation is reused (added the view #: reference to the existing th.po entry rather than creating a duplicate).

No model, security, or test changes — the guard, its message, and its test already existed.

Test plan

  • Restart with -u disbursement_finance_kmitl so the view and translation reload.
  • Take a DR to bills_posted, open it from the audit queue with เรื่องที่จ่าย empty, on an untouched form: each smart button opens instead of raising an "Invalid fields" toast; breadcrumb back to list works.
  • Dirty the form (click into a payment line) and repeat, plus a pager arrow.
  • Warning banner is visible on Payment Execution page throughout.
  • Press ตรวจสอบการเบิกจ่าย with no subject → UserError, state stays bills_posted.
  • Select a subject → banner disappears, rows derive their หัวจ่าย, audit succeeds.
  • Batch ตรวจสอบ from the audit queue on a subject-less request → same UserError, nothing advances.
  • oca_run_tests limited to disbursement_finance_kmitl stays green.

…osted when payment subject is empty

payment_subject_id was required in the view exactly at bills_posted, the one
state every request arrives at with the field empty (the accounting bridge
writes that state; choosing the subject is the auditor's own first job).
Every type="object" button save-validates the whole form regardless of
dirty state, so the auditor's smart buttons (ใบตั้งหนี้, payments, journal
entries, sarabun) were blocked on an untouched form.

The requirement is already enforced server-side by
_check_payment_classification, the only transition that consumes it, with
its own translated UserError and test coverage. Drop the view-level
required, keep readonly, and replace the lost asterisk with a
non-blocking warning banner reusing the same message.
@coreichamp
coreichamp merged commit 46c409a into 16.0 Sep 8, 2026
1 check passed
@coreichamp
coreichamp deleted the coreichamp/16.0-fix-disbursement_finance_kmitl-audit-subject-required branch September 8, 2026 03:27
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