From 8cbf5bc1f114f69f1963280b468e058c8b5ebf65 Mon Sep 17 00:00:00 2001 From: tfr Date: Mon, 7 Feb 2011 00:16:47 +0100 Subject: [PATCH] [FIX] previous stage didn't worked bzr revid: tfr@openerp.com-20110206231647-dg5f50am7wsuuz7g --- addons/crm/crm.py | 2 +- addons/crm/crm_lead.py | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) 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): """