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_driver_count

Inputs Method Outputs
  • id
order_data = self.env["tms.driver"].read_group(
            [("tms_team_id", "in", self.ids)],
            ["tms_team_id"],
            ["tms_team_id"],
        )
result = {
            data["tms_team_id"][0]: int(data["tms_team_id_count"])
            for data in order_data
        }
for team in self:
            team.driver_count = result.get(team.id, 0)

Back to entity