[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) <tde@openerp.com>
This commit is contained in:
fw-bot
2019-10-07 10:28:04 +00:00
committed by Thibault Delavallée
parent 42417956c0
commit 4c10ff6683
+2 -2
View File
@@ -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([