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.member

Compute Method: _compute_lead_month_count

View 17.0 View 19.0
Inputs Method Outputs
  • user_id
  • user_id.id
  • crm_team_id
  • crm_team_id.id
+ month_date = fields.Datetime.now() - datetime.timedelta(days=30)
+ monthly_leads_counts = self._get_lead_from_date(month_date)
for member in self:
-             if member.user_id.id and member.crm_team_id.id:
-                 member.lead_month_count = self.env['crm.lead'].with_context(active_test=False).search_count(
-                     member._get_lead_month_domain()
-                 )
-             else:
-                 member.lead_month_count = 0
+             member.lead_month_count = monthly_leads_counts.get((member.user_id.id, member.crm_team_id.id), 0)
  • lead_month_count

Back to entity