Odoo Mindscape. Understand Odoo faster. Explore modules, fields, dependencies and version differences in one place instead of digging through the source code.

Module: CRM

Entity: crm.team

Compute Method: _compute_lead_unassigned_count

Inputs Method Outputs
  • id
leads_data = self.env['crm.lead']._read_group([
            ('team_id', 'in', self.ids),
            ('user_id', '=', False),
        ], ['team_id'], ['__count'])
counts = {team.id: count for team, count in leads_data}
for team in self:
            team.lead_unassigned_count = counts.get(team.id, 0)

Back to entity