From 521cc20f38fe4571f51345fbd7b5134c292f6fe0 Mon Sep 17 00:00:00 2001 From: Mqdd Date: Sat, 7 Mar 2026 20:49:33 +0700 Subject: cannot cancel invoice if already paid (ask finance to cancel payment) --- fixco_custom/models/account_move.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fixco_custom/models/account_move.py b/fixco_custom/models/account_move.py index aa6d474..7cf030d 100644 --- a/fixco_custom/models/account_move.py +++ b/fixco_custom/models/account_move.py @@ -158,6 +158,8 @@ class AccountMove(models.Model): def button_cancel(self): if self.env.user.id not in [24, 13, 10, 2, 9, 15, 8, 11]: raise UserError('Hanya Accounting yang bisa Cancel') + if self.state == 'posted' and self.payment_state == 'paid': + raise UserError('Invoice Sudah Lunas, Jika Ingin Cancel Hubungi Finance/Accounting untuk cancel pembayaran') res = super(AccountMove, self).button_cancel() return res -- cgit v1.2.3