diff --git a/addons/crm/test/process/lead2opportunity2win.yml b/addons/crm/test/process/lead2opportunity2win.yml index 981a11a59ed..6d7d1179153 100644 --- a/addons/crm/test/process/lead2opportunity2win.yml +++ b/addons/crm/test/process/lead2opportunity2win.yml @@ -13,13 +13,13 @@ - I fill in a lead2partner wizard. - - !record {model: crm.generate.partner, id: crm_generate_partner_id1, context: '{"active_model": "crm.lead", "active_ids": [ref("crm_case_4")]}'}: + !record {model: crm.partner.binding, id: crm_partner_binding_id1, context: '{"active_model": "crm.lead", "active_ids": [ref("crm_case_4")]}'}: - I create a partner from the lead2partner wizard. - - !python {model: crm.generate.partner}: | + !python {model: crm.partner.binding}: | context.update({'active_model': 'crm.lead', 'active_ids': [ref('crm_case_4')], 'active_id': ref('crm_case_4')}) - self.make_partner(cr, uid ,[ref("crm_generate_partner_id1")], context=context) + self.make_partner(cr, uid ,[ref("crm_partner_binding_id1")], context=context) - I convert lead into opportunity for exiting customer. - diff --git a/addons/crm/wizard/__init__.py b/addons/crm/wizard/__init__.py index ea522a036b8..5795b5ccc64 100644 --- a/addons/crm/wizard/__init__.py +++ b/addons/crm/wizard/__init__.py @@ -19,7 +19,7 @@ # ############################################################################## -import crm_generate_partner +import crm_partner_binding import crm_phonecall_to_phonecall import crm_opportunity_to_phonecall import crm_lead_to_opportunity diff --git a/addons/crm/wizard/crm_lead_to_opportunity.py b/addons/crm/wizard/crm_lead_to_opportunity.py index eea1e90a254..750ac46d97d 100644 --- a/addons/crm/wizard/crm_lead_to_opportunity.py +++ b/addons/crm/wizard/crm_lead_to_opportunity.py @@ -27,7 +27,7 @@ import re class crm_lead2opportunity_partner(osv.osv_memory): _name = 'crm.lead2opportunity.partner' _description = 'Lead To Opportunity Partner' - _inherit = 'crm.generate.partner' + _inherit = 'crm.partner.binding' _columns = { 'name': fields.selection([ diff --git a/addons/crm/wizard/crm_generate_partner.py b/addons/crm/wizard/crm_partner_binding.py similarity index 88% rename from addons/crm/wizard/crm_generate_partner.py rename to addons/crm/wizard/crm_partner_binding.py index 39d5282a34f..53461d1f508 100644 --- a/addons/crm/wizard/crm_generate_partner.py +++ b/addons/crm/wizard/crm_partner_binding.py @@ -22,15 +22,17 @@ from osv import osv, fields from tools.translate import _ -class crm_generate_partner(osv.osv_memory): +class crm_partner_binding(osv.osv_memory): """ - Handle the partner generation from any CRM item (lead, phonecall) - either by explicitly converting the element to a partner, either by - triggering an action that will create a partner (e.g. convert a lead into - an opportunity). + Handle the partner binding or generation in any CRM wizard that requires + such feature, like the lead2opportunity wizard, or the + phonecall2opportunity wizard. Try to find a matching partner from the + CRM model's information (name, email, phone number, etc) or create a new + one on the fly. + Use it like a mixin with the wizard of your choice. """ - _name = 'crm.generate.partner' - _description = 'Generate a partner from a CRM item.' + _name = 'crm.partner.binding' + _description = 'Handle partner binding or generation in CRM wizards.' _columns = { 'action': fields.selection([ ('exist', 'Link to an existing customer'), @@ -80,7 +82,7 @@ class crm_generate_partner(osv.osv_memory): return partner_id def default_get(self, cr, uid, fields, context=None): - res = super(crm_generate_partner, self).default_get(cr, uid, fields, context=context) + res = super(crm_partner_binding, self).default_get(cr, uid, fields, context=context) partner_id = self._find_matching_partner(cr, uid, context=context) if 'action' in fields: