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

Module: Stock - Maintenance

Entity: stock.location

Compute Method: _compute_equipment_count

Inputs Method Outputs
  • id
equipment_data = self.env['maintenance.equipment']._read_group([('location_id', 'in', self.ids)], ['location_id'], ['__count'])
mapped_data = {location.id: count for location, count in equipment_data}
for location in self:
            location.equipment_count = mapped_data.get(location.id, 0)

Back to entity