From c7a772f62893ddbce3699e5a6008e960a9f773af Mon Sep 17 00:00:00 2001 From: "Touati Djamel (otd)" Date: Fri, 21 Jan 2022 13:09:39 +0000 Subject: [PATCH] [FIX] point_of_sale: fix pos_action access error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Steps to reproduce the bug: - Log in as Admin - Go to POS and open a session - Select a customer for the order and complete the order - Close the POS session - Go to the associated customer to view their contact record - Click the smart button for "Orders" > Admin can see POS orders for customer - Log out, then log in as Demo - Go to the contact and click the smart button for "Orders” Problem: An access error was raised: `You are not allowed to access 'Action Window' (ir.actions.act_window) records.` Only people in group Administration/Settings could read `action_pos_pos_form` Solution: To avoid this error, we should use `_for_xml_id`. Opw-2734462 closes odoo/odoo#83214 X-original-commit: 05d17c9734249ed5a34ae84124bf14fd1b5f3b7c Signed-off-by: Nicolas Lempereur (nle) Signed-off-by: Djamel Touati (otd) --- addons/point_of_sale/models/res_partner.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/point_of_sale/models/res_partner.py b/addons/point_of_sale/models/res_partner.py index f0cc11bf854..39917239744 100644 --- a/addons/point_of_sale/models/res_partner.py +++ b/addons/point_of_sale/models/res_partner.py @@ -36,7 +36,7 @@ class ResPartner(models.Model): ''' This function returns an action that displays the pos orders from partner. ''' - action = self.env.ref('point_of_sale.action_pos_pos_form').read()[0] + action = self.env['ir.actions.act_window']._for_xml_id('point_of_sale.action_pos_pos_form') if self.is_company: action['domain'] = [('partner_id.commercial_partner_id.id', '=', self.id)] else: