From 4c10ff6683c730a97f4385d5ec7f827fd459697f Mon Sep 17 00:00:00 2001 From: fw-bot Date: Thu, 3 Oct 2019 16:51:35 +0000 Subject: [PATCH] [FIX] crm: avoid copying stage_id and probability when duplicating a lead When Lead is duplicated, `stage_id` should not be copied for obvious reason. Indeed it should go through the pipeline again, with probably and stage_id being freshly computed again. closes odoo/odoo#37927 Signed-off-by: Thibault Delavallee (tde) --- addons/crm/models/crm_lead.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/crm/models/crm_lead.py b/addons/crm/models/crm_lead.py index c2a2bb40759..546c52452dd 100644 --- a/addons/crm/models/crm_lead.py +++ b/addons/crm/models/crm_lead.py @@ -92,7 +92,7 @@ class Lead(models.Model): priority = fields.Selection(crm_stage.AVAILABLE_PRIORITIES, string='Priority', index=True, default=crm_stage.AVAILABLE_PRIORITIES[0][0]) date_closed = fields.Datetime('Closed Date', readonly=True, copy=False) - stage_id = fields.Many2one('crm.stage', string='Stage', ondelete='restrict', tracking=True, index=True, + stage_id = fields.Many2one('crm.stage', string='Stage', ondelete='restrict', tracking=True, index=True, copy=False, domain="['|', ('team_id', '=', False), ('team_id', '=', team_id)]", group_expand='_read_group_stage_ids', default=lambda self: self._default_stage_id()) user_id = fields.Many2one('res.users', string='Salesperson', index=True, tracking=True, default=lambda self: self.env.user) @@ -105,7 +105,7 @@ class Lead(models.Model): date_conversion = fields.Datetime('Conversion Date', readonly=True) # Probability - Only used for type opportunity - probability = fields.Float('Probability', group_operator="avg") + probability = fields.Float('Probability', group_operator="avg", copy=False) automated_probability = fields.Float('Automated Probability', readonly=True) is_automated_probability = fields.Boolean('Is automated probability?', compute="_compute_is_automated_probability") phone_state = fields.Selection([