[FIX] mrp: skip cancelled WOs in _start_nextworkorder
When start_nextworkorder, if the WO is already cancelled, we should try to check next one the this WO. Task-2678388 closes odoo/odoo#83566 X-original-commit: 30fcfcc6c6ebb6fe9620d29475e1a7b6f1a46923 Related: odoo/enterprise#23819 Signed-off-by: Arnold Moyaux <arm@odoo.com> Signed-off-by: Yuchen Huang (yhu) <yhu@odoo.com>
This commit is contained in:
@@ -497,8 +497,12 @@ class MrpWorkorder(models.Model):
|
||||
return self.production_id.move_finished_ids.filtered(lambda x: (x.product_id.id != self.production_id.product_id.id) and (x.state not in ('done', 'cancel')))
|
||||
|
||||
def _start_nextworkorder(self):
|
||||
if self.state == 'done' and self.next_work_order_id.state == 'pending':
|
||||
self.next_work_order_id.state = 'ready' if self.next_work_order_id.production_availability == 'assigned' else 'waiting'
|
||||
if self.state == 'done':
|
||||
next_order = self.next_work_order_id
|
||||
while next_order and next_order.state == 'cancel':
|
||||
next_order = next_order.next_work_order_id
|
||||
if next_order.state == 'pending':
|
||||
next_order.state = 'ready' if next_order.production_availability == 'assigned' else 'waiting'
|
||||
|
||||
@api.model
|
||||
def gantt_unavailability(self, start_date, end_date, scale, group_bys=None, rows=None):
|
||||
|
||||
Reference in New Issue
Block a user