From dc3e522b74630e33c48beab57954a43327f2819c Mon Sep 17 00:00:00 2001 From: Patrick Wilson <36892066+patrickrwilson@users.noreply.github.com> Date: Fri, 16 Sep 2022 15:03:33 -0400 Subject: [PATCH] [14.0][FIX] rma (Action v14 compatibility) Same fix as #305 but for delivery and rma on picking --- rma/models/rma.py | 8 ++------ rma/models/stock_picking.py | 2 +- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/rma/models/rma.py b/rma/models/rma.py index 50a93bf9..1d79a16a 100644 --- a/rma/models/rma.py +++ b/rma/models/rma.py @@ -788,8 +788,6 @@ class Rma(models.Model): def action_view_receipt(self): """Invoked when 'Receipt' smart button in rma form view is clicked.""" self.ensure_one() - # Force active_id to avoid issues when coming from smart buttons - # in other models action = self.env["ir.actions.actions"]._for_xml_id( "stock.action_picking_tree_all" ) @@ -816,10 +814,8 @@ class Rma(models.Model): def action_view_delivery(self): """Invoked when 'Delivery' smart button in rma form view is clicked.""" - action = ( - self.env.ref("stock.action_picking_tree_all") - .with_context(active_id=self.id) - .read()[0] + action = self.env["ir.actions.actions"]._for_xml_id( + "stock.action_picking_tree_all" ) picking = self.delivery_move_ids.mapped("picking_id") if len(picking) > 1: diff --git a/rma/models/stock_picking.py b/rma/models/stock_picking.py index 242871d5..29c71528 100644 --- a/rma/models/stock_picking.py +++ b/rma/models/stock_picking.py @@ -29,7 +29,7 @@ class StockPicking(models.Model): def action_view_rma(self): self.ensure_one() - action = self.sudo().env.ref("rma.rma_action").read()[0] + action = self.env["ir.actions.actions"]._for_xml_id("rma.rma_action") rma = self.move_lines.mapped("rma_ids") if len(rma) == 1: action.update(