From b84a0f9df45ad16bd0ed397acca4b1985a2d4a32 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Tue, 13 Oct 2020 15:17:47 +0000 Subject: [PATCH] [FIX] sale_timesheet: access action using sudo The method _to_action_data needs to retrieve the action as sudo to be able to read it's content. Before this commit, an access right error was raised when a user clicked on the "Overview" button on the project kanban, when trying to read the content of the project.action_view_task record closes odoo/odoo#59974 X-original-commit: 80c87e2562681ca95fa9c6c91e6564c8ad8f1cb5 Signed-off-by: Martin Trigaux (mat) --- addons/sale_timesheet/models/project_overview.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/addons/sale_timesheet/models/project_overview.py b/addons/sale_timesheet/models/project_overview.py index c55fa64e9e2..c752f67ea2a 100644 --- a/addons/sale_timesheet/models/project_overview.py +++ b/addons/sale_timesheet/models/project_overview.py @@ -429,7 +429,7 @@ class Project(models.Model): action_data = _to_action_data('project.project', res_id=self.id, views=[[self.env.ref('project.edit_project').id, 'form']]) else: - action_data = _to_action_data(action=self.env.ref('project.open_view_project_all_config'), + action_data = _to_action_data(action=self.env.ref('project.open_view_project_all_config').sudo(), domain=[('id', 'in', self.ids)]) stat_buttons.append({ @@ -457,7 +457,7 @@ class Project(models.Model): 'count': sum(self.mapped('task_count')), 'icon': 'fa fa-tasks', 'action': _to_action_data( - action=self.env.ref('project.action_view_task'), + action=self.env.ref('project.action_view_task').sudo(), domain=tasks_domain, context=tasks_context ) @@ -467,7 +467,7 @@ class Project(models.Model): 'count': self.env['project.task'].search_count(late_tasks_domain), 'icon': 'fa fa-tasks', 'action': _to_action_data( - action=self.env.ref('project.action_view_task'), + action=self.env.ref('project.action_view_task').sudo(), domain=late_tasks_domain, context=tasks_context, ), @@ -477,7 +477,7 @@ class Project(models.Model): 'count': self.env['project.task'].search_count(overtime_tasks_domain), 'icon': 'fa fa-tasks', 'action': _to_action_data( - action=self.env.ref('project.action_view_task'), + action=self.env.ref('project.action_view_task').sudo(), domain=overtime_tasks_domain, context=tasks_context, ), @@ -497,7 +497,7 @@ class Project(models.Model): 'count': len(sale_orders), 'icon': 'fa fa-dollar', 'action': _to_action_data( - action=self.env.ref('sale.action_orders'), + action=self.env.ref('sale.action_orders').sudo(), domain=[('id', 'in', sale_orders.ids)], context={'create': False, 'edit': False, 'delete': False} ) @@ -514,7 +514,7 @@ class Project(models.Model): 'count': len(invoice_ids), 'icon': 'fa fa-pencil-square-o', 'action': _to_action_data( - action=self.env.ref('account.action_move_out_invoice_type'), + action=self.env.ref('account.action_move_out_invoice_type').sudo(), domain=[('id', 'in', invoice_ids), ('move_type', '=', 'out_invoice')], context={'create': False, 'delete': False} )