From 3cbdfe8807834c3aa741ce08442b7cd4c2db38e3 Mon Sep 17 00:00:00 2001 From: Jorge Pinna Puissant Date: Wed, 5 Jun 2019 09:24:58 +0000 Subject: [PATCH] [FIX] crm: change team with the default one - Have two crm teams with the same team leader, and without team members (team1, team2 as instance). - Create a new lead, add as Salesperson the team leader, and as Sales team the second previously created team (team2). - Save the new lead. Before this commit, when we save the lead, the sales team will change, to set the default sales team for the chosen Salesperson, in this case team1. opw-2005924 closes odoo/odoo#33898 Signed-off-by: Simon Goffin (sig) --- addons/crm/models/crm_lead.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/crm/models/crm_lead.py b/addons/crm/models/crm_lead.py index 367dd35309a..417a94f3bd2 100644 --- a/addons/crm/models/crm_lead.py +++ b/addons/crm/models/crm_lead.py @@ -254,7 +254,7 @@ class Lead(models.Model): 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: + if user_id in team.member_ids.ids or user_id == team.user_id.id: return {} team_id = self.env['crm.team']._get_default_team_id(user_id=user_id) return {'team_id': team_id}