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
driver_data = self.env["tms.driver"]._read_group(
            domain=[("tms_team_id", "in", self.ids)],
            groupby=["tms_team_id"],
            aggregates=["__count"],
        )
result = {team.id: count for team, count in driver_data if team}
for team in self:
            team.driver_count = result.get(team.id, 0)

Back to entity