[FIX] sales_team: multicompany issue typo 3ad1867e
3ad1867e could lead to wrong results in a multicompany setting because
the change got the company from the lead but it was intended to be
gotten from the user.
Since ('company_id', 'child_of', False) returned "root" companies, the
code still got a sales team but possibly one from another company if the
user was on another company that its sales team.
This would lead to an access issue that this commit solves.
opw-784455
closes #21428
This commit is contained in:
@@ -19,7 +19,7 @@ class CrmTeam(models.Model):
|
||||
if 'default_team_id' in self.env.context:
|
||||
team_id = self.env['crm.team'].browse(self.env.context.get('default_team_id'))
|
||||
if not team_id or not team_id.exists():
|
||||
company_id = self.sudo(user_id).company_id.id
|
||||
company_id = self.sudo(user_id).env.user.company_id.id
|
||||
team_id = self.env['crm.team'].sudo().search([
|
||||
'|', ('user_id', '=', user_id), ('member_ids', '=', user_id),
|
||||
'|', ('company_id', '=', False), ('company_id', 'child_of', [company_id])
|
||||
|
||||
Reference in New Issue
Block a user