[IMP] rma_sale: rollback sale refund on deleted invoice

TT44043
This commit is contained in:
David
2023-06-23 11:45:40 +02:00
committed by Pedro M. Baeza
parent 944f9686cc
commit f77eeb3acc

View File

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