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

Module: Repairs

Entity: stock.lot

Compute Method: _compute_repaired_count

Inputs Method Outputs
  • id
lot_data = self.env['repair.order']._read_group([('lot_id', 'in', self.ids), ('state', '=', 'done')], ['lot_id'], ['__count'])
result = {lot.id: count for lot, count in lot_data}
for lot in self:
            lot.repaired_count = result.get(lot.id, 0)

Back to entity