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

Entity: fsm.team

Compute Method: _compute_order_count

View 17.0 View 19.0
Inputs Method Outputs
  • id
- order_data = self.env["fsm.order"].read_group(
-             [("team_id", "in", self.ids), ("stage_id.is_closed", "=", False)],
-             ["team_id"],
-             ["team_id"],
+ order_data = self.env["fsm.order"]._read_group(
+             domain=Domain.AND(
+                 [
+                     Domain("team_id", "in", self.ids),
+                     Domain("stage_id.is_closed", "=", False),
+                 ]
+             ),
+             groupby=["team_id"],
+             aggregates=["__count"],
        )
- result = {data["team_id"][0]: int(data["team_id_count"]) for data in order_data}
+ result = {team.id: count for team, count in order_data}
for team in self:
            team.order_count = result.get(team.id, 0)
  • order_count

Back to entity