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

Module: Project

Entity: project.task

Compute Method: _compute_recurring_count

Inputs Method Outputs
self.recurring_count = 0
recurring_tasks = self.filtered(lambda l: l.recurrence_id)
count = self.env['project.task']._read_group([('recurrence_id', 'in', recurring_tasks.recurrence_id.ids)], ['recurrence_id'], ['__count'])
tasks_count = {recurrence.id: count for recurrence, count in count}
for task in recurring_tasks:
            task.recurring_count = tasks_count.get(task.recurrence_id.id, 0)

Back to entity