From 9787b8acbe0be5312a3bdce8bf17c05b5587d484 Mon Sep 17 00:00:00 2001 From: TheClaud99 <39127925+TheClaud99@users.noreply.github.com> Date: Wed, 31 Jul 2024 17:59:54 +0200 Subject: [PATCH 1/2] [FIX] rma_sale: order_id not set on RMA when creating from picking return wizard --- rma_sale/wizard/stock_picking_return.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rma_sale/wizard/stock_picking_return.py b/rma_sale/wizard/stock_picking_return.py index f9bc5823a..a92965e19 100644 --- a/rma_sale/wizard/stock_picking_return.py +++ b/rma_sale/wizard/stock_picking_return.py @@ -17,8 +17,8 @@ def _prepare_rma_partner_values(self): sale_order.partner_shipping_id, ) - def _prepare_rma_values(self): - vals = super()._prepare_rma_values() + def _prepare_rma_vals(self): + vals = super()._prepare_rma_vals() sale_order = self.picking_id.sale_id if sale_order: vals.update( From 5f73bf6b5e962a30502b3d802c91142b56aae0f9 Mon Sep 17 00:00:00 2001 From: claudio-mano Date: Tue, 20 Aug 2024 09:28:41 +0200 Subject: [PATCH 2/2] [FIX] rma_sale: sale_id not assigned to procurement_group when creating from stock.picking return wizard --- rma/wizard/stock_picking_return.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/rma/wizard/stock_picking_return.py b/rma/wizard/stock_picking_return.py index 7c7ca3649..761931397 100644 --- a/rma/wizard/stock_picking_return.py +++ b/rma/wizard/stock_picking_return.py @@ -80,10 +80,6 @@ def _prepare_rma_partner_values(self): def _prepare_rma_vals(self): partner, partner_invoice, partner_shipping = self._prepare_rma_partner_values() origin = self.picking_id.name - vals = self.env["rma"]._prepare_procurement_group_vals() - vals["partner_id"] = partner_shipping.id - vals["name"] = origin - group = self.env["procurement.group"].create(vals) return { "user_id": self.env.user.id, "partner_id": partner.id, @@ -92,7 +88,6 @@ def _prepare_rma_vals(self): "origin": origin, "picking_id": self.picking_id.id, "company_id": self.company_id.id, - "procurement_group_id": group.id, } def _prepare_rma_vals_list(self): @@ -129,6 +124,10 @@ def create_returns(self): ) vals_list = self._prepare_rma_vals_list() rmas = self.env["rma"].create(vals_list) + proc_group_vals = rmas[:1]._prepare_procurement_group_vals() + proc_group_vals["name"] = self.picking_id.name + proc_group = self.env["procurement.group"].create(proc_group_vals) + rmas.write({"procurement_group_id": proc_group.id}) rmas.action_confirm() picking = rmas.reception_move_id.picking_id picking = picking and picking[0] or picking