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

Module: Fleet Vehicle Log Fuel

Entity: fleet.vehicle

Compute Method: _compute_fuel_count

Inputs Method Outputs
  • id
res = self.env["fleet.vehicle.log.fuel"].read_group(
            domain=[("vehicle_id", "in", self.ids)],
            fields=["vehicle_id"],
            groupby=["vehicle_id"],
        )
res_dict = {x["vehicle_id"][0]: x["vehicle_id_count"] for x in res}
for record in self:
            record.fuel_count = res_dict.get(record.id, 0)
return res

Back to entity