From 1cf0cba464012588866b35181e632d92123fe882 Mon Sep 17 00:00:00 2001 From: "Sbh (OpenERP)" Date: Fri, 17 Dec 2010 13:52:14 +0530 Subject: [PATCH 1/2] [Fix] crm: cannot save new lead after have duplicated it lp bug: https://launchpad.net/bugs/691006 fixed bzr revid: sbh@tinyerp.com-20101217082214-9y3my5ytb3mfotnv --- addons/crm/crm_lead.py | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/crm/crm_lead.py b/addons/crm/crm_lead.py index 7aefcc3fb60..fb9a2ae4397 100644 --- a/addons/crm/crm_lead.py +++ b/addons/crm/crm_lead.py @@ -302,6 +302,7 @@ class crm_lead(crm_case, osv.osv): if 'stage_id' in vals and vals['stage_id']: stage_obj = self.pool.get('crm.case.stage').browse(cr, uid, vals['stage_id'], context=context) self.history(cr, uid, ids, _('Stage'), details=stage_obj.name) + message='' for case in self.browse(cr, uid, ids, context=context): if case.type == 'lead': message = _("The stage of lead '%s' has been changed to '%s'.") % (case.name, case.stage_id.name) From 69cadabda6ba99cef703a123323acb4afce6be0a Mon Sep 17 00:00:00 2001 From: "Sbh (OpenERP)" Date: Fri, 17 Dec 2010 15:03:47 +0530 Subject: [PATCH 2/2] [Fix] crm: fix problem of duplicate lead bzr revid: sbh@tinyerp.com-20101217093347-6o4fv1uvnxydlom1 --- addons/crm/crm_lead.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/addons/crm/crm_lead.py b/addons/crm/crm_lead.py index fb9a2ae4397..f1667282d65 100644 --- a/addons/crm/crm_lead.py +++ b/addons/crm/crm_lead.py @@ -304,11 +304,10 @@ class crm_lead(crm_case, osv.osv): self.history(cr, uid, ids, _('Stage'), details=stage_obj.name) message='' for case in self.browse(cr, uid, ids, context=context): - if case.type == 'lead': + if case.type == 'lead' or context.get('stage_type',False)=='lead': message = _("The stage of lead '%s' has been changed to '%s'.") % (case.name, case.stage_id.name) elif case.type == 'opportunity': message = _("The stage of opportunity '%s' has been changed to '%s'.") % (case.name, case.stage_id.name) - self.log(cr, uid, case.id, message) return super(crm_lead,self).write(cr, uid, ids, vals, context) def stage_next(self, cr, uid, ids, context=None):