From 7d4715f821e0355df1bf4643090433c03e66ff1f Mon Sep 17 00:00:00 2001 From: david Date: Mon, 17 Jan 2022 09:44:13 +0100 Subject: [PATCH] [FIX] rma: return wizard to_refund To create the rma we create the core return wizard, which now sets to_refund to True as default. This isn't right for RMAs anyway. TT33706 --- rma/__manifest__.py | 2 +- rma/models/rma.py | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/rma/__manifest__.py b/rma/__manifest__.py index 8d6f0745..84b39b7d 100644 --- a/rma/__manifest__.py +++ b/rma/__manifest__.py @@ -10,7 +10,7 @@ "author": "Tecnativa, Odoo Community Association (OCA)", "maintainers": ["ernestotejeda"], "license": "AGPL-3", - "depends": ["account", "stock"], + "depends": ["stock_account"], "data": [ "views/report_rma.xml", "report/report.xml", diff --git a/rma/models/rma.py b/rma/models/rma.py index ee79e08d..172d9fa5 100644 --- a/rma/models/rma.py +++ b/rma/models/rma.py @@ -912,7 +912,14 @@ class Rma(models.Model): lambda r: r.move_id != self.move_id ).unlink() return_line = return_wizard.product_return_moves - return_line.quantity = self.product_uom_qty + return_line.update( + { + "quantity": self.product_uom_qty, + # The to_refund field is now True by default, which isn't right in the RMA + # creation context. + "to_refund": False, + } + ) # set_rma_picking_type is to override the copy() method of stock # picking and change the default picking type to rma picking type. picking_action = return_wizard.with_context(