From b626bdc68d6a6de399f96cfba032e93c3b66aebf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Tue, 29 Sep 2015 10:03:54 +0200 Subject: [PATCH] [FIX][CLEAN] crm: next actions form view + code The display of next actions has been slightly cleaned. Indeed some links were displayed only in edit mode, and the order was strange. Also moved code beloging to crm.team into the right file instead of having 2 overrides in the same module. Also cleaned its code. --- addons/crm/crm_lead.py | 40 ---------------------------------- addons/crm/crm_lead_view.xml | 21 +++++++++--------- addons/crm/sales_team.py | 42 ++++++++++++++++++++++++++++++++++++ 3 files changed, 52 insertions(+), 51 deletions(-) diff --git a/addons/crm/crm_lead.py b/addons/crm/crm_lead.py index 8d0c295176c..21ddb8bf3bc 100644 --- a/addons/crm/crm_lead.py +++ b/addons/crm/crm_lead.py @@ -1235,43 +1235,3 @@ class crm_lost_reason(osv.Model): _defaults = { 'active': True, } - - -class crm_team(osv.Model): - _inherit = "crm.team" - def action_your_pipeline(self, cr, uid, context={}): - imd = self.pool.get('ir.actions.act_window') - imd2 = self.pool.get('ir.model.data') - action = imd.for_xml_id(cr, uid, 'crm', "crm_lead_opportunities_tree_view", context=context) - view_form = imd2.xmlid_lookup(cr, uid, 'crm.crm_case_form_view_oppor')[2] - view_tree = imd2.xmlid_lookup(cr, uid, 'crm.crm_case_tree_view_oppor')[2] - view_kanban = imd2.xmlid_lookup(cr, uid, 'crm.crm_case_kanban_view_leads')[2] - user = self.pool.get('res.users').browse(cr, uid, uid, context=context) - team_id = user.sale_team_id.id - if not team_id: - team_id = self.search(cr, uid, [], context=context, limit=1) - team_id = team_id and team_id[0] - action['help'] = """ -

Click here to add new opportunities

- Looks like you are not a member of a sales team. You should add yourself - as a member of one of the sales team. -

""" - if team_id: - action['help'] += "

As you don't belong to any sales team, Odoo opens the first one by default.

" - newcontext = eval(action['context'], {'uid': uid}) - if team_id: - newcontext.update({ - 'default_team_id': team_id, - 'search_default_team_id': team_id - }) - result = { - 'name': action['name'], - 'help': action['help'], - 'type': action['type'], - 'views': [[view_kanban, 'kanban'], [view_tree, 'tree'], [view_form, 'form'], [False, 'graph'], [False, 'calendar'], [False, 'pivot']], - 'target': action['target'], - 'context': newcontext, - 'res_model': action['res_model'], - } - return result - diff --git a/addons/crm/crm_lead_view.xml b/addons/crm/crm_lead_view.xml index eb1b94b0614..582833f2881 100644 --- a/addons/crm/crm_lead_view.xml +++ b/addons/crm/crm_lead_view.xml @@ -471,39 +471,38 @@ +