[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) <nim@odoo.com>
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user