From d3ea95db516c8660e7dde260776e1f1e955f9154 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Tue, 1 Mar 2016 14:44:36 +0100 Subject: [PATCH] [FIX] crm: convert lead to opportunity When a lead is converted into an opportunity, the probability should match the new stage. opw-669960 --- addons/crm/crm_lead.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/addons/crm/crm_lead.py b/addons/crm/crm_lead.py index e80cf5ee285..3707e318b10 100644 --- a/addons/crm/crm_lead.py +++ b/addons/crm/crm_lead.py @@ -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):