From dd3faf40fa7f7cc897d52532a60d317dcfa9e6b6 Mon Sep 17 00:00:00 2001 From: Yannick Tivisse Date: Tue, 12 Jun 2018 11:34:03 +0200 Subject: [PATCH] [FIX] crm: Don't modify the sales team when removing the salesman Purpose ======= Currently, if we remove the salesman on the lead, the sales team will be replace by either the sales team of the current user or the default sales team. That way, by removing the salesman, we loose information about the sales team, and that way we loose information about the origin of the lead. Specification ============= Don't overwrite the sales team when removing the salesman on the the lead. --- addons/crm/models/crm_lead.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/crm/models/crm_lead.py b/addons/crm/models/crm_lead.py index 06655894e4d..38e03294e52 100644 --- a/addons/crm/models/crm_lead.py +++ b/addons/crm/models/crm_lead.py @@ -236,6 +236,8 @@ class Lead(models.Model): @api.model def _onchange_user_values(self, user_id): """ returns new values when user_id has changed """ + if not user_id: + return {} if user_id and self._context.get('team_id'): team = self.env['crm.team'].browse(self._context['team_id']) if user_id in team.member_ids.ids: