def _compute_lead_unassigned_count(self):
    leads_data = self.env['crm.lead'].read_group([('team_id', 'in', self.ids), ('type', '=', 'lead'), ('user_id', '=', False)], ['team_id'], ['team_id'])
    counts = {datum['team_id'][0]: datum['team_id_count'] for datum in leads_data}
    for team in self:
        team.lead_unassigned_count = counts.get(team.id, 0)
def _compute_lead_unassigned_count(self):
    leads_data = self.env['crm.lead'].read_group([('team_id', 'in', self.ids), ('type', '=', 'lead'), ('user_id', '=', False)], ['team_id'], ['team_id'])
    counts = {datum['team_id'][0]: datum['team_id_count'] for datum in leads_data}
    for team in self:
        team.lead_unassigned_count = counts.get(team.id, 0)