[FIX] account: fix journal items access for non-admin
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) <wan@odoo.com>
This commit is contained in:
@@ -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'] = []
|
||||
|
||||
Reference in New Issue
Block a user