[FIX] crm_lead: cleaned and uniformized won/lost

stage conditions.

bzr revid: tde@openerp.com-20131104115735-4bsv2l2n1c6q8jte
This commit is contained in:
Thibault Delavallée 2013-11-04 12:57:35 +01:00
parent d1c5c84a85
commit 61c97c56de
1 changed files with 3 additions and 3 deletions

View File

@ -74,8 +74,8 @@ class crm_lead(format_address, osv.osv):
# this is only an heuristics; depending on your particular stage configuration it may not match all 'new' stages
'crm.mt_lead_create': lambda self, cr, uid, obj, ctx=None: obj.probability == 0 and obj.stage_id and obj.stage_id.sequence <= 1,
'crm.mt_lead_stage': lambda self, cr, uid, obj, ctx=None: (obj.stage_id and obj.stage_id.sequence > 1) and obj.probability < 100,
'crm.mt_lead_won': lambda self, cr, uid, obj, ctx=None: obj.probability == 100 and obj.stage_id and obj.stage_id.on_change,
'crm.mt_lead_lost': lambda self, cr, uid, obj, ctx=None: obj.probability == 0 and obj.stage_id and obj.stage_id.sequence > 1,
'crm.mt_lead_won': lambda self, cr, uid, obj, ctx=None: obj.probability == 100 and obj.stage_id and obj.stage_id.fold,
'crm.mt_lead_lost': lambda self, cr, uid, obj, ctx=None: obj.probability == 0 and obj.stage_id and obj.stage_id.fold and obj.stage_id.sequence > 1,
},
}
@ -406,7 +406,7 @@ class crm_lead(format_address, osv.osv):
:deprecated: this method will be removed in OpenERP v8.
"""
for lead in self.browse(cr, uid, ids):
stage_id = self.stage_find(cr, uid, [lead], lead.section_id.id or False, [('probability', '=', 100.0), ('fold', '=', True), ('sequence', '>', 1)], context=context)
stage_id = self.stage_find(cr, uid, [lead], lead.section_id.id or False, [('probability', '=', 100.0), ('fold', '=', True)], context=context)
if stage_id:
return self.write(cr, uid, [lead.id], {'stage_id': stage_id}, context=context)
else: