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_opportunity_count

View 20.0
Inputs Method Outputs
  • id
+ leads_data = self.env['crm.lead']._read_group([
+             ('team_id', 'in', self.ids),
+             ('type', '=', 'opportunity'),
+         ], ['team_id'], ['__count'])
+ counts = {team.id: count for team, count in leads_data}
+ for team in self:
+             team.opportunity_count = counts.get(team.id, 0)
  • opportunity_count

Back to entity