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 Recurring Work Orders

Entity: fsm.team

Compute Method: _compute_recurring_draft_count

Inputs Method Outputs
order_data = self.env["fsm.recurring"]._read_group(
            domain=Domain.AND(
                [
                    Domain("team_id", "in", self.ids),
                    Domain("state", "=", "draft"),
                ]
            ),
            groupby=["team_id"],
            aggregates=["__count"],
        )
for team in self:
            count_data = next(filter(lambda r: r[0] == team, order_data), None)
            team.recurring_draft_count = count_data[1] if count_data else 0

Back to entity