[FIX] sales_team: default team is active

Check the default team is active. Moreover, make the return object type
consistent.

opw-1876966
This commit is contained in:
Nicolas Martinelli
2018-08-21 14:46:11 +02:00
committed by Nicolas Martinelli
parent f46761caa8
commit 65c2a9b70c
+2 -2
View File
@@ -37,8 +37,8 @@ class CrmTeam(models.Model):
try:
default_team_id.check_access_rule('read')
except AccessError:
return False
if self.env.context.get('default_type') != 'lead' or default_team_id.use_leads:
return self.env['crm.team']
if self.env.context.get('default_type') != 'lead' or default_team_id.use_leads and default_team_id.active:
team_id = default_team_id
return team_id