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

Module: Transport

Entity: tms.team

Compute Method: _compute_trips_todo_count

Inputs Method Outputs
  • id
for team in self:
            team.order_ids = self.env["tms.order"].search(
                [
                    ("tms_team_id", "=", team.id),
                    (
                        "stage_id.is_completed",
                        "!=",
                        True,
                    ),
                ]
            )
            data = self.env["tms.order"]._read_group(
                domain=[
                    ("tms_team_id", "=", team.id),
                    (
                        "stage_id.is_completed",
                        "!=",
                        True,
                    ),
                ],
                groupby=["stage_id"],
                aggregates=["__count"],
            )

            team.trips_todo_count = sum(count for _stage, count in data)

Back to entity