From 39f19d14f0d055f40db478ee18f7e8af9d4e480f Mon Sep 17 00:00:00 2001 From: "Lucas Perais (lpe)" Date: Fri, 3 Aug 2018 16:33:00 +0200 Subject: [PATCH] [FIX] crm: enable customizable pipeline action On the pipeline action change the sequence of the view_ids to change the order of the view_mode string Put tree first instead of kanban for example Before this commit, clicking on CRM menu app still displays the kanban This was because the action window is wrapped around a server action that modifies it After this commit, we recompute the view list to match what is on the original action OPW 1863425 closes #26159 --- addons/crm/models/crm_team.py | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/addons/crm/models/crm_team.py b/addons/crm/models/crm_team.py index cddad92eea1..4500f7ca822 100644 --- a/addons/crm/models/crm_team.py +++ b/addons/crm/models/crm_team.py @@ -149,14 +149,22 @@ class Team(models.Model): tree_view_id = self.env.ref('crm.crm_case_tree_view_oppor').id form_view_id = self.env.ref('crm.crm_case_form_view_oppor').id kanb_view_id = self.env.ref('crm.crm_case_kanban_view_leads').id - action['views'] = [ - [kanb_view_id, 'kanban'], - [tree_view_id, 'tree'], - [form_view_id, 'form'], - [False, 'graph'], - [False, 'calendar'], - [False, 'pivot'] - ] + + mode_string = action.get('view_mode', '') + view_mode = mode_string.split(',') if mode_string else ['kanban', 'tree', 'form', 'graph', 'calendar', 'pivot'] + dict_views = { + 'kanban': kanb_view_id, + 'tree': tree_view_id, + 'form': form_view_id, + 'graph': False, + 'calendar': False, + 'pivot': False, + } + + # Sort the views according to the view mode of the action + # which can be modified via studio, or technical menu for that matter + action['views'] = [[dict_views.get(view_type, False), view_type] for view_type in view_mode] + action['context'] = action_context return action