[FIX] crm: date_closed

When a lead is set to 'Won', the date_closed is defined. However, the
user might have clicked by mistake, and he might want to change the
state back. We need to take this into account, otherwise the lead is
considered as closed although it is not.

opw-674226
This commit is contained in:
Nicolas Martinelli
2016-04-12 18:11:04 +02:00
parent 1174cd3fd5
commit 10e1d45db9
+2
View File
@@ -906,6 +906,8 @@ class crm_lead(format_address, osv.osv):
vals.update(onchange_stage_values)
if vals.get('probability') >= 100 or not vals.get('active', True):
vals['date_closed'] = fields.datetime.now()
elif vals.get('probability') < 100:
vals['date_closed'] = False
return super(crm_lead, self).write(cr, uid, ids, vals, context=context)
def copy(self, cr, uid, id, default=None, context=None):