summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorit-fixcomart <it@fixcomart.co.id>2025-08-30 09:23:35 +0700
committerit-fixcomart <it@fixcomart.co.id>2025-08-30 09:23:35 +0700
commit0298605049e29ef436a5e6984b743f89fed712b3 (patch)
tree78cf3fd5b243cc137223d3a0c8e05883ec832ac7
parent3139c592dd1f74b7c6a6c4917419628895296406 (diff)
<hafid> last logic unlink
-rw-r--r--indoteknik_custom/models/refund_sale_order.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/indoteknik_custom/models/refund_sale_order.py b/indoteknik_custom/models/refund_sale_order.py
index 086c7a81..51907083 100644
--- a/indoteknik_custom/models/refund_sale_order.py
+++ b/indoteknik_custom/models/refund_sale_order.py
@@ -660,10 +660,10 @@ class RefundSaleOrder(models.Model):
record.amount_refund_text = ''
def unlink(self):
- not_draft = self.filtered(lambda r: r.status != 'draft')
- if not_draft:
- names = ', '.join(not_draft.mapped('name'))
- raise UserError(f"Refund hanya bisa dihapus jika statusnya masih draft.\nTidak bisa hapus: {names}")
+ incantdelete = self.filtered(lambda r: r.status in ['refund', 'reject'])
+ if incantdelete:
+ names = ', '.join(incantdelete.mapped('name'))
+ raise UserError(f"Refund tidak dapat di hapus jika sudah Confirm/Cancel.\nTidak bisa hapus: {names}")
return super().unlink()
@api.depends('invoice_ids')