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