diff options
| author | Thibault Francois <tfr@openerp.com> | 2020-11-18 11:31:19 +0000 |
|---|---|---|
| committer | Thibault Francois <tfr@openerp.com> | 2020-11-18 11:31:19 +0000 |
| commit | ff43c875a7566ef4473452fc359e73fbf589b615 (patch) | |
| tree | 061048fd29f280050b0fa8c360d9888ea23ae2dc /addons/sale_project/models | |
| parent | 0d4ab53b3f7400151105461973d54c6015550b2f (diff) | |
[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#61928
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Diffstat (limited to 'addons/sale_project/models')
| -rw-r--r-- | addons/sale_project/models/sale_order.py | 5 |
1 files 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() |
