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

Module: Project Task Product

Entity: product.product

Compute Method: _compute_task_count

Inputs Method Outputs
  • id
task_data = self.env["project.task"]._read_group(
            [("product_id", "in", self.ids)],
            groupby=["product_id"],
            aggregates=["__count"],
        )
mapped = {product.id: count for product, count in task_data}
for product in self:
            product.task_count = mapped.get(product.id, 0)

Back to entity