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_state
| Inputs | Method | Outputs |
|---|---|---|
|
for workorder in self: - if workorder.state not in ('pending', 'waiting', 'ready'): - continue - no_recursion_blocked_by_workorder_ids = workorder.blocked_by_workorder_ids.with_context(no_recursion=True) - if workorder.production_availability == 'assigned': - if all(wo.state in ('done', 'cancel') for wo in no_recursion_blocked_by_workorder_ids): - workorder.state = 'ready' - else: - workorder.state = 'pending' - continue - if self._context.get('no_recursion'): + if not workorder.uom_id or workorder.state not in ('blocked', 'ready'): continue - if no_recursion_blocked_by_workorder_ids and not all(wo.state in ('done', 'cancel') for wo in no_recursion_blocked_by_workorder_ids): - workorder.state = 'pending' + all_blocked_by_workorders_done = not workorder.blocked_by_workorder_ids or all(wo.state in ('cancel', 'done') for wo in workorder.blocked_by_workorder_ids) + has_qty_ready = workorder.uom_id.compare(workorder.qty_ready, 0) > 0 + continuous_production = not workorder.blocked_by_workorder_ids or workorder.production_bom_id.continuous + has_all_qties_ready = workorder.uom_id.compare(workorder.qty_ready, workorder.qty_remaining) == 0 and continuous_production + if workorder.qty_produced and workorder.state != 'blocked': + workorder.state = 'progress' + elif all_blocked_by_workorders_done or has_all_qties_ready or (has_qty_ready and continuous_production): + workorder.state = 'ready' else: - workorder.state = 'waiting' + workorder.state = 'blocked' |
|
