From ce39ca8a978bfc2d4c431693fa4c56610fd14368 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Fri, 24 May 2019 08:41:24 +0000 Subject: [PATCH] [FIX] crm: rewrite Assignation Date - Create a lead without Salesperson assigned - Edit the lead, set a Salesperson => the Assignation Date is set - Edit the lead, change the Salesperson The Assignation Date is reset. There is no reason to change the Assignation Date in the second case. Indeed, in many cases the Salesperson is modified for a good reason (e.g. the first person left the company). From a customer perspective, that doesn't change anything: he was always in contact with a salesperson and the lead was handled. Moreover, the reporting becomes incorrect. We only change the Assignation Date if no Salesperson was assigned. opw-2001912 closes odoo/odoo#33640 Signed-off-by: Nicolas Martinelli (nim) --- addons/crm/models/crm_lead.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/crm/models/crm_lead.py b/addons/crm/models/crm_lead.py index 12bbac57459..367dd35309a 100644 --- a/addons/crm/models/crm_lead.py +++ b/addons/crm/models/crm_lead.py @@ -325,7 +325,8 @@ class Lead(models.Model): # stage change: update date_last_stage_update if 'stage_id' in vals: vals['date_last_stage_update'] = fields.Datetime.now() - if vals.get('user_id') and 'date_open' not in vals: + # Only write the 'date_open' if no salesperson was assigned. + if vals.get('user_id') and 'date_open' not in vals and not self.mapped('user_id'): vals['date_open'] = fields.Datetime.now() # stage change with new stage: update probability and date_closed if vals.get('stage_id') and 'probability' not in vals: