From 6554d95ed0ee09b58ba01ae3a7a4c2d823c83667 Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Wed, 9 Aug 2017 14:20:54 +0200 Subject: [PATCH] Revert "[FIX] crm, sale_crm, sales_team, website_crm_partner_assign: change context key" This commit is not retro-compatible with existing database. Moreover, the underlying issue (opw-757039) has been fixed via commit baca743cc0c604613b0408ef2d299bff0720ae37. This reverts commit 8510c0ce3703dd9ab2020cb08305663e7c030725. --- addons/crm/models/crm_lead.py | 8 ++++---- addons/crm/views/crm_lead_views.xml | 8 ++++---- addons/crm/views/crm_team_views.xml | 6 +++--- addons/crm/views/res_partner_views.xml | 2 +- addons/sale_crm/views/crm_lead_views.xml | 2 +- addons/sales_team/models/crm_team.py | 2 +- .../report/crm_lead_report_view.xml | 2 +- 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/addons/crm/models/crm_lead.py b/addons/crm/models/crm_lead.py index 984f3bb735f..ec538ea1fc7 100644 --- a/addons/crm/models/crm_lead.py +++ b/addons/crm/models/crm_lead.py @@ -278,8 +278,8 @@ class Lead(models.Model): # set up context used to find the lead's sales channel which is needed # to correctly set the default stage_id context = dict(self._context or {}) - if vals.get('type') and not self._context.get('default_crm_lead_type'): - context['default_crm_lead_type'] = vals.get('type') + if vals.get('type') and not self._context.get('default_type'): + context['default_type'] = vals.get('type') if vals.get('team_id') and not self._context.get('default_team_id'): context['default_team_id'] = vals.get('team_id') @@ -314,7 +314,7 @@ class Lead(models.Model): self.ensure_one() # set default value in context, if not already set (Put stage to 'new' stage) context = dict(self._context) - context.setdefault('default_crm_lead_type', self.type) + context.setdefault('default_type', self.type) context.setdefault('default_team_id', self.team_id.id) # Set date_open to today if it is an opp default = default or {} @@ -822,7 +822,7 @@ class Lead(models.Model): (False, 'graph') ], 'type': 'ir.actions.act_window', - 'context': {'default_crm_lead_type': 'opportunity'} + 'context': {'default_type': 'opportunity'} } @api.multi diff --git a/addons/crm/views/crm_lead_views.xml b/addons/crm/views/crm_lead_views.xml index 6be52219429..fff0436699f 100644 --- a/addons/crm/views/crm_lead_views.xml +++ b/addons/crm/views/crm_lead_views.xml @@ -702,7 +702,7 @@ if record: { - 'default_crm_lead_type':'lead', + 'default_type':'lead', 'search_default_type': 'lead', 'needaction_menu_ref': 'crm.menu_crm_opportunities', 'search_default_to_process':1, @@ -736,7 +736,7 @@ if record: kanban,tree,graph,pivot,form,calendar [('type','=','opportunity')] { - 'default_crm_lead_type': 'opportunity', + 'default_type': 'opportunity', 'default_user_id': uid } @@ -787,7 +787,7 @@ if record: kanban,tree,graph,pivot,form,calendar [('type','=','opportunity')] { - 'default_crm_lead_type': 'opportunity', + 'default_type': 'opportunity', 'default_user_id': uid, 'search_default_assigned_to_me': 1, } @@ -832,7 +832,7 @@ if record: (0, 0, {'view_mode': 'kanban'}), (0, 0, {'view_mode': 'calendar'}), (0, 0, {'view_mode': 'pivot'}), (0, 0, {'view_mode': 'graph'})]"/> [('type','=','opportunity'), ('activity_date_deadline', '!=', False)] { - 'default_crm_lead_type': 'opportunity', + 'default_type': 'opportunity', 'default_user_id': uid, 'search_default_assigned_to_me': 1 } diff --git a/addons/crm/views/crm_team_views.xml b/addons/crm/views/crm_team_views.xml index 86ac9ebb18b..23698ecc36c 100644 --- a/addons/crm/views/crm_team_views.xml +++ b/addons/crm/views/crm_team_views.xml @@ -12,7 +12,7 @@ { 'search_default_team_id': [active_id], 'default_team_id': active_id, - 'default_crm_lead_type': 'lead', + 'default_type': 'lead', } @@ -39,7 +39,7 @@ { 'search_default_team_id': [active_id], 'default_team_id': active_id, - 'default_crm_lead_type': 'opportunity', + 'default_type': 'opportunity', 'default_user_id': uid, } @@ -151,7 +151,7 @@ { 'search_default_team_id': [active_id], 'default_team_id': active_id, - 'default_crm_lead_type': 'opportunity', + 'default_type': 'opportunity', 'default_user_id': uid, } diff --git a/addons/crm/views/res_partner_views.xml b/addons/crm/views/res_partner_views.xml index dfdfee87069..08541cb35a1 100644 --- a/addons/crm/views/res_partner_views.xml +++ b/addons/crm/views/res_partner_views.xml @@ -18,7 +18,7 @@ [('type','=','opportunity')] { 'search_default_partner_id': active_id, - 'default_crm_lead_type': 'opportunity' + 'default_type': 'opportunity' } diff --git a/addons/sale_crm/views/crm_lead_views.xml b/addons/sale_crm/views/crm_lead_views.xml index 637f2abff56..2f3f7883fe7 100644 --- a/addons/sale_crm/views/crm_lead_views.xml +++ b/addons/sale_crm/views/crm_lead_views.xml @@ -42,7 +42,7 @@ - {'default_crm_lead_type': 'opportunity', 'default_user_id': uid, 'needaction_menu_ref': 'sale.menu_sale_quotations'} + {'default_type': 'opportunity', 'default_user_id': uid, 'needaction_menu_ref': 'sale.menu_sale_quotations'} diff --git a/addons/sales_team/models/crm_team.py b/addons/sales_team/models/crm_team.py index 2e253919a10..c4cb8b74301 100644 --- a/addons/sales_team/models/crm_team.py +++ b/addons/sales_team/models/crm_team.py @@ -33,7 +33,7 @@ class CrmTeam(models.Model): team_id = self.env['crm.team'].browse(self.env.context.get('default_team_id')) if not team_id: default_team_id = self.env.ref('sales_team.team_sales_department', raise_if_not_found=False) - if default_team_id and (self.env.context.get('default_crm_lead_type') != 'lead' or default_team_id.use_leads): + if default_team_id and (self.env.context.get('default_type') != 'lead' or default_team_id.use_leads): team_id = default_team_id return team_id diff --git a/addons/website_crm_partner_assign/report/crm_lead_report_view.xml b/addons/website_crm_partner_assign/report/crm_lead_report_view.xml index 7077d490c4f..d2d7aab1cf0 100644 --- a/addons/website_crm_partner_assign/report/crm_lead_report_view.xml +++ b/addons/website_crm_partner_assign/report/crm_lead_report_view.xml @@ -64,7 +64,7 @@ Opp. Assignment Analysis crm.lead.report.assign form - {'default_crm_lead_type': 'opportunity', 'group_by_no_leaf':1,'group_by':[]} + {'default_type': 'opportunity', 'group_by_no_leaf':1,'group_by':[]} pivot,graph [('type', '=', 'opportunity')]