[MERGE] merged the branch from cbi that fixes the default stage on leads/opportunities

bzr revid: qdp-launchpad@openerp.com-20121228140733-ywx93g9y66zrs2ci
This commit is contained in:
Quentin (OpenERP)
2012-12-28 15:07:33 +01:00
+7
View File
@@ -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_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)
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)