[FIX] crm: When converting lead to opportunity , with No link to partner Its generate traceback
bzr revid: ron@tinyerp.com-20111123072020-8esmtpmwkdtdmasa
This commit is contained in:
parent
1098a57e13
commit
4228eff228
|
@ -523,7 +523,9 @@ class crm_lead(crm_case, osv.osv):
|
||||||
|
|
||||||
def _convert_opportunity_data(self, cr, uid, lead, customer, section_id=False, context=None):
|
def _convert_opportunity_data(self, cr, uid, lead, customer, section_id=False, context=None):
|
||||||
crm_stage = self.pool.get('crm.case.stage')
|
crm_stage = self.pool.get('crm.case.stage')
|
||||||
contact_id = self.pool.get('res.partner').address_get(cr, uid, [customer.id])['default']
|
contact_id = False
|
||||||
|
if customer:
|
||||||
|
contact_id = self.pool.get('res.partner').address_get(cr, uid, [customer.id])['default']
|
||||||
if not section_id:
|
if not section_id:
|
||||||
section_id = lead.section_id and lead.section_id.id or False
|
section_id = lead.section_id and lead.section_id.id or False
|
||||||
if section_id:
|
if section_id:
|
||||||
|
@ -535,7 +537,7 @@ class crm_lead(crm_case, osv.osv):
|
||||||
'planned_revenue': lead.planned_revenue,
|
'planned_revenue': lead.planned_revenue,
|
||||||
'probability': lead.probability,
|
'probability': lead.probability,
|
||||||
'name': lead.name,
|
'name': lead.name,
|
||||||
'partner_id': customer.id,
|
'partner_id': customer and customer.id or False,
|
||||||
'user_id': (lead.user_id and lead.user_id.id),
|
'user_id': (lead.user_id and lead.user_id.id),
|
||||||
'type': 'opportunity',
|
'type': 'opportunity',
|
||||||
'stage_id': stage_id or False,
|
'stage_id': stage_id or False,
|
||||||
|
@ -552,9 +554,9 @@ class crm_lead(crm_case, osv.osv):
|
||||||
def convert_opportunity(self, cr, uid, ids, partner_id, user_ids=False, section_id=False, context=None):
|
def convert_opportunity(self, cr, uid, ids, partner_id, user_ids=False, section_id=False, context=None):
|
||||||
partner = self.pool.get('res.partner')
|
partner = self.pool.get('res.partner')
|
||||||
mail_message = self.pool.get('mail.message')
|
mail_message = self.pool.get('mail.message')
|
||||||
|
customer = False
|
||||||
customer = partner.browse(cr, uid, partner_id, context=context)
|
if partner_id:
|
||||||
|
customer = partner.browse(cr, uid, partner_id, context=context)
|
||||||
for lead in self.browse(cr, uid, ids, context=context):
|
for lead in self.browse(cr, uid, ids, context=context):
|
||||||
if lead.state in ('done', 'cancel'):
|
if lead.state in ('done', 'cancel'):
|
||||||
continue
|
continue
|
||||||
|
|
Loading…
Reference in New Issue