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_has_planning_issues

Inputs Method Outputs
self.has_planning_issues = False
for wo in self:
            if not wo.date_start or not wo.date_finished or not wo.ids:
                continue
            if wo.state in ('blocked', 'ready'):
                previous_wos = wo.blocked_by_workorder_ids
                previous_starts = previous_wos.filtered('date_start').mapped('date_start')
                previous_finished = previous_wos.filtered('date_finished').mapped('date_finished')
                prev_start = min(previous_starts) if previous_starts else False
                prev_finished = max(previous_finished) if previous_finished else False
                if prev_start and prev_start > wo.date_start or prev_finished and prev_finished > wo.date_start:
                    wo.has_planning_issues = True

Back to entity