[FIX] crm: date_closed when writting without probability value

If `probability` is not being written,
`vals.get('probability')` is `None`
`None` < 100 is `True`

While it should not remove the `date_closed` value
when the probability field is not being rewritten
on the lead, but something else is.

opw-677273
This commit is contained in:
Denis Ledoux
2016-05-31 19:05:22 +02:00
parent 8c337f9743
commit b46b0936a8
+1 -1
View File
@@ -906,7 +906,7 @@ 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:
elif 'probability' in vals and vals['probability'] < 100:
vals['date_closed'] = False
return super(crm_lead, self).write(cr, uid, ids, vals, context=context)