summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Lempereur <nle@odoo.com>2017-12-04 16:59:07 +0100
committerNicolas Lempereur <nle@odoo.com>2017-12-05 11:07:51 +0100
commit04bfd54013cd26d95332641789b4e2b294c4b3b5 (patch)
tree9c582a43037cfc45c61119a52a2557e5a224c404
parentfe8668e509d36b48a6be0c82f46a44a0f553cbb6 (diff)
[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
-rw-r--r--addons/sales_team/models/crm_team.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/addons/sales_team/models/crm_team.py b/addons/sales_team/models/crm_team.py
index 2eebdd5eceb..ae491e7866e 100644
--- a/addons/sales_team/models/crm_team.py
+++ b/addons/sales_team/models/crm_team.py
@@ -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])