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()