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

Module: CRM - Project

Entity: crm.lead

Compute Method: _compute_task_count

Inputs Method Outputs
task_count_per_lead = dict(
            self.env['project.task']._read_group(
                domain=[('project_id', 'in', self.project_ids.ids)],
                groupby=['project_id.lead_id'],
                aggregates=['__count'],
            ),
        )
for lead in self:
            lead.task_count = task_count_per_lead.get(lead, 0)

Back to entity