From cf6d56ae71c8c45dbbc88c48bf83677ce5111eb7 Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Wed, 16 Aug 2023 16:56:23 +0700 Subject: Update account move hanya bisa di delete jika status nya bukan posted --- indoteknik_custom/models/account_move.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/indoteknik_custom/models/account_move.py b/indoteknik_custom/models/account_move.py index b188285d..9e7266b1 100644 --- a/indoteknik_custom/models/account_move.py +++ b/indoteknik_custom/models/account_move.py @@ -31,7 +31,8 @@ class AccountMove(models.Model): def unlink(self): res = super(AccountMove, self).unlink() - raise UserError('Data Hanya Bisa Di Cancel') + if self.state == 'posted': + raise UserError('Data Hanya Bisa Di Cancel') return res def button_cancel(self): -- cgit v1.2.3