From e198ff4d4a557b699db49e0c5fb025e54c4f9c4f Mon Sep 17 00:00:00 2001 From: "qdp-launchpad@tinyerp.com" <> Date: Thu, 30 Sep 2010 16:41:14 +0200 Subject: [PATCH] [IMP] crm, leads and opportunities: when opening a case, the stage shouldn't change unless there is still not a stage set bzr revid: qdp-launchpad@tinyerp.com-20100930144114-3r5gcu6xsnehk31p --- addons/crm/crm_lead.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) 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):