[FIX] crm: convert lead to opportunity

When a lead is converted into an opportunity, the probability should match
the new stage.

opw-669960
This commit is contained in:
Nicolas Martinelli
2016-03-01 17:39:14 +01:00
parent bdd60a75af
commit d3ea95db51
+4 -1
View File
@@ -704,7 +704,10 @@ class crm_lead(format_address, osv.osv):
'date_conversion': fields.datetime.now(),
}
if not lead.stage_id or lead.stage_id.type=='lead':
val['stage_id'] = self.stage_find(cr, uid, [lead], team_id, [('type', 'in', ('opportunity', 'both'))], context=context)
stage_id = self.stage_find(cr, uid, [lead], team_id, [('type', 'in', ['opportunity', 'both'])], context=context)
val['stage_id'] = stage_id
if stage_id:
val['probability'] = self.pool['crm.stage'].browse(cr, uid, stage_id, context=context).probability
return val
def convert_opportunity(self, cr, uid, ids, partner_id, user_ids=False, team_id=False, context=None):