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

Module: Fleet

Entity: fleet.vehicle.model.brand

Compute Method: _compute_model_count

Inputs Method Outputs
  • id
model_data = self.env['fleet.vehicle.model']._read_group([
            ('brand_id', 'in', self.ids), ('active', '=', True)
        ], ['brand_id'], ['__count'])
models_brand = {brand.id: count for brand, count in model_data}
for record in self:
            record.model_count = models_brand.get(record.id, 0)

Back to entity