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_opportunities_overdue_data

View 17.0
Inputs Method Outputs
  • id
- opportunity_data = self.env['crm.lead']._read_group([
-             ('team_id', 'in', self.ids),
-             ('probability', '<', 100),
-             ('type', '=', 'opportunity'),
-             ('date_deadline', '<', fields.Date.to_string(fields.Datetime.now()))
-         ], ['team_id'], ['__count', 'expected_revenue:sum'])
- counts_amounts = {team.id: (count, expected_revenue_sum) for team, count, expected_revenue_sum in opportunity_data}
- for team in self:
-             team.opportunities_overdue_count, team.opportunities_overdue_amount = counts_amounts.get(team.id, (0, 0))
  • opportunities_overdue_count
  • opportunities_overdue_amount

Back to entity