[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) <yti@odoo.com>
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user