From 39888a51286ecfe1916a8c3c403ae54de357df1f Mon Sep 17 00:00:00 2001 From: Chris Biersbach Date: Fri, 28 Dec 2012 13:18:58 +0100 Subject: [PATCH 1/2] [FIX] Leads no longer get a random draft stage, but correctly get one from their sales team bzr revid: cbi@openerp.com-20121228121858-bcbsinqx7ong724c --- addons/crm/crm_lead.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/addons/crm/crm_lead.py b/addons/crm/crm_lead.py index bbd7e3a56b9..4b50737ce0f 100644 --- a/addons/crm/crm_lead.py +++ b/addons/crm/crm_lead.py @@ -84,6 +84,13 @@ class crm_lead(base_stage, format_address, osv.osv): }, } + def create(self, cr, uid, vals, context=None): + if not context.get('default_section', False) and vals.get('section_id', False): + ctx = context.copy() + ctx['default_section_id'] = vals['section_id'] + vals['stage_id'] = self._get_default_stage_id(cr, uid, context=ctx) + return super(crm_lead, self).create(cr, uid, vals, context=context) + def _get_default_section_id(self, cr, uid, context=None): """ Gives default section by checking if present in the context """ return (self._resolve_section_id_from_context(cr, uid, context=context) or False) From 3ee1580802b0422f68dc2abbfd8a68156ee7e2e7 Mon Sep 17 00:00:00 2001 From: Chris Biersbach Date: Fri, 28 Dec 2012 13:23:43 +0100 Subject: [PATCH 2/2] [IMP] Typo bzr revid: cbi@openerp.com-20121228122343-wulz32j4yfk5cot2 --- addons/crm/crm_lead.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/crm/crm_lead.py b/addons/crm/crm_lead.py index 4b50737ce0f..bf9e83215df 100644 --- a/addons/crm/crm_lead.py +++ b/addons/crm/crm_lead.py @@ -85,7 +85,7 @@ class crm_lead(base_stage, format_address, osv.osv): } def create(self, cr, uid, vals, context=None): - if not context.get('default_section', False) and vals.get('section_id', False): + if not context.get('default_section_id', False) and vals.get('section_id', False): ctx = context.copy() ctx['default_section_id'] = vals['section_id'] vals['stage_id'] = self._get_default_stage_id(cr, uid, context=ctx)