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

View 18.0 View 19.0
Inputs Method Outputs
  • id
- order_data = self.env["fsm.recurring"].read_group(
-             [
-                 ("team_id", "in", self.ids),
-                 ("state", "=", "draft"),
-             ],
-             ["team_id"],
-             ["team_id"],
+ 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"],
        )
- result = {data["team_id"][0]: int(data["team_id_count"]) for data in order_data}
for team in self:
-             team.recurring_draft_count = result.get(team.id, 0)
+             count_data = next(filter(lambda r: r[0] == team, order_data), None)
+             team.recurring_draft_count = count_data[1] if count_data else 0
  • recurring_draft_count

Back to entity