From 695e482b5ee25a66a178f61eeec64ad0ecaf4b76 Mon Sep 17 00:00:00 2001 From: Thibault Francois Date: Wed, 18 Nov 2020 11:31:19 +0000 Subject: [PATCH] [FIX] sale_project: Fix access error on action read Problem ------- When a sale order has more than one task within the same project clicking on X tasks lead to an access error since regular user cannot read action anymore Solution --------- use _for_xml_id method to fetch action data closes odoo/odoo#61953 X-original-commit: ff43c875a7566ef4473452fc359e73fbf589b615 Signed-off-by: Yannick Tivisse (yti) --- addons/sale_project/models/sale_order.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/addons/sale_project/models/sale_order.py b/addons/sale_project/models/sale_order.py index e259c7d654b..e779902dcc4 100644 --- a/addons/sale_project/models/sale_order.py +++ b/addons/sale_project/models/sale_order.py @@ -66,11 +66,10 @@ class SaleOrder(models.Model): form_view_id = self.env.ref('project.view_task_form2').id action = {'type': 'ir.actions.act_window_close'} - task_projects = self.tasks_ids.mapped('project_id') if len(task_projects) == 1 and len(self.tasks_ids) > 1: # redirect to task of the project (with kanban stage, ...) - action = self.with_context(active_id=task_projects.id).env.ref( - 'project.act_project_project_2_project_task_all').read()[0] + action = self.with_context(active_id=task_projects.id).env['ir.actions.actions']._for_xml_id( + 'project.act_project_project_2_project_task_all') action['domain'] = [('id', 'in', self.tasks_ids.ids)] if action.get('context'): eval_context = self.env['ir.actions.actions']._get_eval_context()