From 10e1d45db992b51d0973180f954eabfdd9ff3fa2 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Tue, 12 Apr 2016 18:11:04 +0200 Subject: [PATCH] [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 --- addons/crm/crm_lead.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/crm/crm_lead.py b/addons/crm/crm_lead.py index 43d0b18b0c7..711292eb4e3 100644 --- a/addons/crm/crm_lead.py +++ b/addons/crm/crm_lead.py @@ -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):