diff --git a/addons/crm/crm.py b/addons/crm/crm.py index 0b6275598d2..2d371c3f865 100644 --- a/addons/crm/crm.py +++ b/addons/crm/crm.py @@ -219,11 +219,11 @@ class crm_case(object): if context is None: context = {} stage_pool = self.pool.get('crm.case.stage') - stage_type = context and context.get('stage_type','') current_seq = False next_stage_id = False for case in self.browse(cr, uid, ids, context=context): + stage_type = case.type next_stage = False value = {} if case.section_id.id : diff --git a/addons/crm/crm_lead.py b/addons/crm/crm_lead.py index 9fd7aa81d4c..1b0121cb278 100644 --- a/addons/crm/crm_lead.py +++ b/addons/crm/crm_lead.py @@ -297,6 +297,16 @@ class crm_lead(crm_case, osv.osv): data = {'probability': stage_obj.probability} self.write(cr, uid, ids, data) return stage + + def stage_previous(self, cr, uid, ids, context=None): + stage = super(crm_lead, self).stage_previous(cr, uid, ids, context=context) + if stage: + stage_obj = self.pool.get('crm.case.stage').browse(cr, uid, stage, context=context) + if stage_obj.on_change: + data = {'probability': stage_obj.probability} + self.write(cr, uid, ids, data) + return stage + def message_new(self, cr, uid, msg, context=None): """