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.workorder

Compute Method: _compute_scrap_move_count

View 19.0
Inputs Method Outputs
  • id
- data = self.env['stock.scrap']._read_group([('workorder_id', 'in', self.ids)], ['workorder_id'], ['__count'])
- count_data = {workorder.id: count for workorder, count in data}
- for workorder in self:
-             workorder.scrap_count = count_data.get(workorder.id, 0)
  • scrap_count

Back to entity