[FIX] rma: avoid reopening a cancelled RMA when the reception is deleted

When we delete the reception for an RMA, we're setting it to draft
automatically so we can confirm it again and create a new reception.
This is unconvenient when the RMA is cancelled, as we don't wan't to
reopen it automatically.

TT41943
This commit is contained in:
David
2023-03-09 17:29:45 +01:00
committed by Víctor Martínez
parent ee2d79e976
commit 1640e5af0b
2 changed files with 4 additions and 2 deletions

View File

@@ -3,7 +3,7 @@
{
"name": "Return Merchandise Authorization Management",
"summary": "Return Merchandise Authorization (RMA)",
"version": "15.0.1.1.1",
"version": "15.0.1.1.2",
"development_status": "Production/Stable",
"category": "RMA",
"website": "https://github.com/OCA/rma",

View File

@@ -35,7 +35,9 @@ class StockMove(models.Model):
rma_receiver = self.sudo().mapped("rma_receiver_ids")
rma = self.sudo().mapped("rma_id")
res = super().unlink()
rma_receiver.write({"state": "draft"})
rma_receiver.filtered(lambda x: x.state != "cancelled").write(
{"state": "draft"}
)
rma.update_received_state()
rma.update_replaced_state()
return res