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(
                [
                    ("tms_team_id", "=", team.id),
                    (
                        "stage_id.is_completed",
                        "!=",
                        True,
                    ),
                ],
                ["stage_id"],
                ["stage_id", "count(*) as count"],
            )

            team.trips_todo_count = 0

            for record in data:
                if "stage_id_count" in record:
                    team.trips_todo_count += record["stage_id_count"]

Back to entity