From 6d94f02ea192cccae6b7f80dccaf112624177d8d Mon Sep 17 00:00:00 2001 From: Victor Feyens Date: Thu, 20 Feb 2020 10:05:44 +0000 Subject: [PATCH] [IMP] sales_team: member_ids search performance. Each search on member_ids will trigger a ref call (one exists query each time), whereas we could just directly use the appropriate share field on res_users. --- addons/sales_team/models/crm_team.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/sales_team/models/crm_team.py b/addons/sales_team/models/crm_team.py index 9c3c0ef349b..4b84837c506 100644 --- a/addons/sales_team/models/crm_team.py +++ b/addons/sales_team/models/crm_team.py @@ -46,7 +46,7 @@ class CrmTeam(models.Model): user_id = fields.Many2one('res.users', string='Team Leader', check_company=True) member_ids = fields.One2many( 'res.users', 'sale_team_id', string='Channel Members', check_company=True, - domain=lambda self: [('groups_id', 'in', self.env.ref('base.group_user').id)], + domain=[('share', '=', False)], help="Add members to automatically assign their documents to this sales team. You can only be member of one team.") favorite_user_ids = fields.Many2many( 'res.users', 'team_favorite_user_rel', 'team_id', 'user_id',