Skip to content

[16.0][ADD] purchase_guarantee_disbursement: guarantee refund via disbursement#586

Open
coreichamp wants to merge 4 commits into16.0from
16.0-add-guarantee-disbursement-return
Open

[16.0][ADD] purchase_guarantee_disbursement: guarantee refund via disbursement#586
coreichamp wants to merge 4 commits into16.0from
16.0-add-guarantee-disbursement-return

Conversation

@coreichamp
Copy link
Contributor

@coreichamp coreichamp commented Mar 12, 2026

Summary

  • Add new module purchase_guarantee_disbursement with full guarantee lifecycle: draft → lock → received → returned
  • Receipt control: Limit to 1 payment per guarantee; "สร้างใบส่งเงิน" button hidden after payment created
  • Auto state transitions: lock → received when payment posted, received → returned when refund bill posted (via account.move._post() override)
  • Refund via disbursement: "คืนเงินหลักประกัน" button only visible after receipt completed (state == received), creates pre-filled disbursement request with partner, amount, account, and analytic dimensions
  • Bill linking: Disbursement-created bills auto-linked to guarantee.bill_ids for amount_returned tracking
  • Depends on purchase_guarantee_account_payment and disbursement

Test plan

  • Create guarantee → Lock → verify only "สร้างใบส่งเงิน" visible, "คืนเงินหลักประกัน" hidden
  • Create payment → Post payment → verify state auto-transitions to "received"
  • Verify second payment cannot be created (button hidden)
  • Verify "คืนเงินหลักประกัน" now visible
  • Create disbursement → Submit → Validate → Create Bill → Post bill
  • Verify state auto-transitions to "returned"
  • Verify statusbar shows all 4 states correctly
  • Verify smart buttons navigate correctly both directions

…bursement

Add new module to enable refunding purchase guarantees through the disbursement system. Integrates guarantee records with disbursement requests, enabling approval workflows (draft → submitted → validated → bill creation). When a disbursement bill is created, it automatically links to guarantee.bill_ids, updating amount_returned. Supports partial refunds via multiple disbursement requests. Follows the pattern of purchase_order_disbursement module.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
@coreichamp coreichamp force-pushed the 16.0-add-guarantee-disbursement-return branch from c00e0b5 to f50e5d8 Compare March 12, 2026 08:44
PHATTARAPON.K added 2 commits March 13, 2026 15:25
… states

Add guarantee state flow: draft → lock → received → returned.
- Extend state with received/returned via selection_add
- Auto-transition lock→received when payment is posted
- Auto-transition received→returned when refund bill is posted
- Limit payment creation to 1 per guarantee
- Refund button only visible after receipt is completed
- Add purchase_guarantee_account_payment as dependency
@coreichamp coreichamp changed the title [16.0][ADD] purchase_guarantee_disbursement: guarantee refund via disbursement [16.0][ADD] purchase_guarantee_disbursement: guarantee lifecycle and refund Mar 13, 2026
@coreichamp coreichamp changed the title [16.0][ADD] purchase_guarantee_disbursement: guarantee lifecycle and refund [16.0][ADD] purchase_guarantee_disbursement: guarantee refund via disbursement Mar 13, 2026
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