[FIX] crm: lead crash on changing stage using next/previous button
bzr revid: hmo@tinyerp.com-20100309130406-tydf3pljplnjb7q3
This commit is contained in:
+4
-6
@@ -295,9 +295,8 @@ class crm_case(osv.osv):
|
||||
section = (case.section_id.id or False)
|
||||
if section in s:
|
||||
st = case.stage_id.id or False
|
||||
if st in s[section]:
|
||||
stage_value = self.pool.get('crm.case.stage').read(cr, uid,s[section][st] , ['probability'], context)
|
||||
self.write(cr, uid, [case.id], {'stage_id': s[section][st],'probability':stage_value['probability']})
|
||||
if st in s[section]:
|
||||
self.write(cr, uid, [case.id], {'stage_id': s[section][st]})
|
||||
return True
|
||||
|
||||
def get_stage_dict(self, cr, uid, ids, context={}):
|
||||
@@ -318,9 +317,8 @@ class crm_case(osv.osv):
|
||||
if section in s:
|
||||
st = case.stage_id.id or False
|
||||
s[section] = dict([(v, k) for (k, v) in s[section].iteritems()])
|
||||
if st in s[section]:
|
||||
stage_value = self.pool.get('crm.case.stage').read(cr, uid,s[section][st] ,['probability'], context)
|
||||
self.write(cr, uid, [case.id], {'stage_id': s[section][st],'probability':stage_value['probability']})
|
||||
if st in s[section]:
|
||||
self.write(cr, uid, [case.id], {'stage_id': s[section][st]})
|
||||
return True
|
||||
|
||||
|
||||
|
||||
@@ -61,6 +61,20 @@ class crm_opportunity(osv.osv):
|
||||
return {'value':{}}
|
||||
return {'value':{'probability':stage.probability}}
|
||||
|
||||
def stage_next(self, cr, uid, ids, context={}):
|
||||
res = super(crm_opportunity, self).stage_next(cr, uid, ids, context=context)
|
||||
for case in self.browse(cr, uid, ids, context):
|
||||
if case.stage_id and case.stage_id.on_change:
|
||||
self.write(cr, uid, [case.id], {'probability': case.stage_id.probability})
|
||||
return res
|
||||
|
||||
def stage_previous(self, cr, uid, ids, context={}):
|
||||
res = super(crm_opportunity, self).stage_previous(cr, uid, ids, context=context)
|
||||
for case in self.browse(cr, uid, ids, context):
|
||||
if case.stage_id and case.stage_id.on_change:
|
||||
self.write(cr, uid, [case.id], {'probability': case.stage_id.probability})
|
||||
return res
|
||||
|
||||
_defaults = {
|
||||
'company_id': lambda s,cr,uid,c: s.pool.get('res.company')._company_default_get(cr, uid, 'crm.opportunity', context=c),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user