From 034137d25b8933f57b8da598ca7a20ec34305092 Mon Sep 17 00:00:00 2001 From: "Anh Thao Pham (pta)" Date: Tue, 12 Mar 2024 11:25:59 +0100 Subject: [PATCH] [FIX] account: fix journal items access for non-admin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Steps to reproduce: - Install Accounting - Connect with a user without "Administration: Settings" rights (e.g. Marc Demo) - Go to "Accounting / Accounting / Journals / Journal Items" Issue: An Access Error is raised when trying to access a "ir.ui.view" record that is restricted to "Administration/Settings" group. opw-3787114 closes odoo/odoo#157363 Signed-off-by: William André (wan) --- addons/account/models/account_move_line.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/models/account_move_line.py b/addons/account/models/account_move_line.py index 30004f1f6ec..bebceb0789d 100644 --- a/addons/account/models/account_move_line.py +++ b/addons/account/models/account_move_line.py @@ -451,7 +451,7 @@ class AccountMoveLine(models.Model): @api.model def get_views(self, views, options=None): res = super().get_views(views, options) - if res['views'].get('list') and self.env['ir.ui.view'].browse(res['views']['list']['id']).name == "account.move.line.payment.tree": + if res['views'].get('list') and self.env['ir.ui.view'].sudo().browse(res['views']['list']['id']).name == "account.move.line.payment.tree": if toolbar := res['views']['list'].get('toolbar'): # We dont want any additionnal action in the "account.move.line.payment.tree" view toolbar toolbar['action'] = []