From 9838954f73ea031cef255976314e13b30747481d Mon Sep 17 00:00:00 2001 From: Lois Rilo Date: Fri, 16 Apr 2021 13:07:38 +0200 Subject: [PATCH] [14.0][MIG] rma*: ir.actions.act_window has different access right in v14. Actions that read those records need to use `sudo` to allow non-admin users to be able to use these actions. --- rma_account/models/account_move.py | 4 ++-- rma_account/wizards/rma_refund.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/rma_account/models/account_move.py b/rma_account/models/account_move.py index 602b0542..5bc0e1fc 100644 --- a/rma_account/models/account_move.py +++ b/rma_account/models/account_move.py @@ -64,7 +64,7 @@ class AccountMove(models.Model): def action_view_rma_supplier(self): action = self.env.ref("rma.action_rma_supplier_lines") - result = action.read()[0] + result = action.sudo().read()[0] rma_ids = self.mapped("line_ids.rma_line_ids").ids if rma_ids: # choose the view_mode accordingly @@ -78,7 +78,7 @@ class AccountMove(models.Model): def action_view_rma_customer(self): action = self.env.ref("rma.action_rma_customer_lines") - result = action.read()[0] + result = action.sudo().read()[0] rma_ids = self.mapped("line_ids.rma_line_ids").ids if rma_ids: # choose the view_mode accordingly diff --git a/rma_account/wizards/rma_refund.py b/rma_account/wizards/rma_refund.py index 7a2553f2..eccc6077 100644 --- a/rma_account/wizards/rma_refund.py +++ b/rma_account/wizards/rma_refund.py @@ -98,7 +98,7 @@ class RmaRefund(models.TransientModel): if (new_invoice.move_type in ["out_refund", "out_invoice"]) else "action_move_in_refund_type" ) - result = self.env.ref("account.%s" % action).read()[0] + result = self.env.ref("account.%s" % action).sudo().read()[0] form_view = self.env.ref("account.move_supplier_form", False) result["views"] = [(form_view and form_view.id or False, "form")] result["res_id"] = new_invoice.id