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

Module: Field Service - Agreements

Entity: agreement

Compute Method: _compute_service_order_count

Inputs Method Outputs
  • id
data = self.env["fsm.order"]._read_group(
            [("agreement_id", "in", self.ids)],
            ["agreement_id"],
            ["__count"],
        )
counts = {rec.id: count for rec, count in data}
for rec in self:
            rec.service_order_count = counts.get(rec.id, 0)

Back to entity