summaryrefslogtreecommitdiff
path: root/addons/crm/crm_lead.py
diff options
context:
space:
mode:
Diffstat (limited to 'addons/crm/crm_lead.py')
-rw-r--r--addons/crm/crm_lead.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/addons/crm/crm_lead.py b/addons/crm/crm_lead.py
index ac22a1a7bd9..755eb374823 100644
--- a/addons/crm/crm_lead.py
+++ b/addons/crm/crm_lead.py
@@ -295,11 +295,11 @@ class crm_lead(format_address, osv.osv):
team = self.pool['crm.team'].browse(cr, uid, context['team_id'], context=context)
if user_id in team.member_ids.ids:
return {}
- team_id = self.pool['crm.team']._get_default_team_id(cr, uid, context=context, user_id=user_id)
- if user_id and not team_id and self.pool['res.users'].has_group(cr, uid, 'base.group_multi_salesteams'):
- team_ids = self.pool.get('crm.team').search(cr, uid, ['|', ('user_id', '=', user_id), ('member_ids', '=', user_id)], context=context)
- if team_ids:
- team_id = team_ids[0]
+ team_ids = self.pool.get('crm.team').search(
+ cr, uid, ['|', ('user_id', '=', user_id), ('member_ids', '=', user_id)], limit=1, context=context)
+ team_id = team_ids and team_ids[0] or False
+ if not team_id:
+ team_id = self.pool['crm.team']._get_default_team_id(cr, uid, context=context, user_id=user_id)
return {'value': {'team_id': team_id}}
def stage_find(self, cr, uid, cases, team_id, domain=None, order='sequence', context=None):