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'):
                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'
            else:
                workorder.state = 'waiting'

Back to entity