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

Module: Manufacturing

Entity: mrp.routing.workcenter

Compute Method: _compute_workorder_count

Inputs Method Outputs
  • id
data = self.env['mrp.workorder']._read_group([
            ('operation_id', 'in', self.ids),
            ('state', '=', 'done')], ['operation_id'], ['__count'])
count_data = {operation.id: count for operation, count in data}
for operation in self:
            operation.workorder_count = count_data.get(operation.id, 0)

Back to entity