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

Module: Agreement - Project

Entity: agreement

Compute Method: _compute_task_count

Inputs Method Outputs
  • id
groups = self.env["project.task"]._read_group(
            [("agreement_id", "in", self.ids)],
            groupby=["agreement_id"],
            aggregates=["__count"],
        )
counts = {agreement.id: count for agreement, count in groups}
for ag in self:
            ag.task_count = counts.get(ag.id, 0)

Back to entity