From f77eeb3accffc8293a08a11130612032427c17f2 Mon Sep 17 00:00:00 2001 From: David Date: Fri, 23 Jun 2023 11:45:40 +0200 Subject: [PATCH] [IMP] rma_sale: rollback sale refund on deleted invoice TT44043 --- rma_sale/models/account_move.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/rma_sale/models/account_move.py b/rma_sale/models/account_move.py index e5a5a7a8..3048289a 100644 --- a/rma_sale/models/account_move.py +++ b/rma_sale/models/account_move.py @@ -22,3 +22,9 @@ class AccountMove(models.Model): if rma.sale_line_id: rma._link_refund_with_reception_move() return super().button_draft() + + def unlink(self): + """If the invoice is removed, rollback the quantities correction""" + for rma in self.invoice_line_ids.rma_id.filtered("sale_line_id"): + rma._unlink_refund_with_reception_move() + return super().unlink()