diff --git a/addons/crm/crm_lead.py b/addons/crm/crm_lead.py index cdc3553dc0e..76260082602 100644 --- a/addons/crm/crm_lead.py +++ b/addons/crm/crm_lead.py @@ -185,14 +185,16 @@ class crm_lead(crm_case, osv.osv): @param *args: Give Tuple Value """ old_state = self.read(cr, uid, ids, ['state'])[0]['state'] + old_stage_id = self.read(cr, uid, ids, ['stage_id'])[0]['stage_id'] res = super(crm_lead, self).case_open(cr, uid, ids, *args) if old_state == 'draft': - stage_id = super(crm_lead, self).stage_next(cr, uid, ids, *args) - if stage_id: - value = self.onchange_stage_id(cr, uid, ids, stage_id, context={})['value'] - else: - value = {} - value.update({'date_open': time.strftime('%Y-%m-%d %H:%M:%S'), 'stage_id': stage_id}) + value = {} + if not old_stage_id: + stage_id = super(crm_lead, self).stage_next(cr, uid, ids, *args) + if stage_id: + value.update({'stage_id': stage_id}) + value.update(self.onchange_stage_id(cr, uid, ids, stage_id, context={})['value']) + value.update({'date_open': time.strftime('%Y-%m-%d %H:%M:%S')}) self.write(cr, uid, ids, value) for (id, name) in self.name_get(cr, uid, ids):