[FIX] crm: lead to opportunity conversion: when creating a customer, use the email_from to try to find a name to the partner before using the subject.
bzr revid: tde@openerp.com-20130131152820-wyz2026n0hdr87dn
This commit is contained in:
@@ -716,7 +716,7 @@ class crm_lead(base_stage, format_address, osv.osv):
|
||||
|
||||
def _lead_create_contact(self, cr, uid, lead, name, is_company, parent_id=False, context=None):
|
||||
partner = self.pool.get('res.partner')
|
||||
vals = { 'name': name,
|
||||
vals = {'name': name,
|
||||
'user_id': lead.user_id.id,
|
||||
'comment': lead.description,
|
||||
'section_id': lead.section_id.id or False,
|
||||
@@ -736,11 +736,11 @@ class crm_lead(base_stage, format_address, osv.osv):
|
||||
'is_company': is_company,
|
||||
'type': 'contact'
|
||||
}
|
||||
partner = partner.create(cr, uid,vals, context)
|
||||
partner = partner.create(cr, uid, vals, context=context)
|
||||
return partner
|
||||
|
||||
def _create_lead_partner(self, cr, uid, lead, context=None):
|
||||
partner_id = False
|
||||
partner_id = False
|
||||
if lead.partner_name and lead.contact_name:
|
||||
partner_id = self._lead_create_contact(cr, uid, lead, lead.partner_name, True, context=context)
|
||||
partner_id = self._lead_create_contact(cr, uid, lead, lead.contact_name, False, partner_id, context=context)
|
||||
@@ -748,6 +748,9 @@ class crm_lead(base_stage, format_address, osv.osv):
|
||||
partner_id = self._lead_create_contact(cr, uid, lead, lead.partner_name, True, context=context)
|
||||
elif not lead.partner_name and lead.contact_name:
|
||||
partner_id = self._lead_create_contact(cr, uid, lead, lead.contact_name, False, context=context)
|
||||
elif lead.email_from:
|
||||
contact_name, contact_email = self.pool.get('res.partner')._parse_partner_name(lead.email_from, context=context)
|
||||
partner_id = self._lead_create_contact(cr, uid, lead, contact_name, False, context=context)
|
||||
else:
|
||||
partner_id = self._lead_create_contact(cr, uid, lead, lead.name, False, context=context)
|
||||
return partner_id
|
||||
|
||||
Reference in New Issue
Block a user