[FIX] crm: write a value to date_closed when mark an opportunity as won or lost.
This value is required to compute 'Days to Close' field bzr revid: mat@openerp.com-20140307111835-o7nd7dmkn5y8zg2a
This commit is contained in:
parent
c375851b46
commit
8db1b77757
|
@ -440,7 +440,7 @@ class crm_lead(base_stage, format_address, osv.osv):
|
||||||
for lead in self.browse(cr, uid, ids):
|
for lead in self.browse(cr, uid, ids):
|
||||||
stage_id = self.stage_find(cr, uid, [lead], lead.section_id.id or False, [('probability', '=', 0.0),('on_change','=',True)], context=context)
|
stage_id = self.stage_find(cr, uid, [lead], lead.section_id.id or False, [('probability', '=', 0.0),('on_change','=',True)], context=context)
|
||||||
if stage_id:
|
if stage_id:
|
||||||
self.case_set(cr, uid, [lead.id], values_to_update={'probability': 0.0}, new_stage_id=stage_id, context=context)
|
self.case_set(cr, uid, [lead.id], values_to_update={'probability': 0.0, 'date_closed': fields.datetime.now()}, new_stage_id=stage_id, context=context)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def case_mark_won(self, cr, uid, ids, context=None):
|
def case_mark_won(self, cr, uid, ids, context=None):
|
||||||
|
@ -448,7 +448,7 @@ class crm_lead(base_stage, format_address, osv.osv):
|
||||||
for lead in self.browse(cr, uid, ids):
|
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),('on_change','=',True)], context=context)
|
stage_id = self.stage_find(cr, uid, [lead], lead.section_id.id or False, [('probability', '=', 100.0),('on_change','=',True)], context=context)
|
||||||
if stage_id:
|
if stage_id:
|
||||||
self.case_set(cr, uid, [lead.id], values_to_update={'probability': 100.0}, new_stage_id=stage_id, context=context)
|
self.case_set(cr, uid, [lead.id], values_to_update={'probability': 100.0, 'date_closed': fields.datetime.now()}, new_stage_id=stage_id, context=context)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def set_priority(self, cr, uid, ids, priority):
|
def set_priority(self, cr, uid, ids, priority):
|
||||||
|
|
Loading…
Reference in New Issue