Skip to content

Commit

Permalink
[FIX] mrp: start the next workorder in a function to allow for overrides
Browse files Browse the repository at this point in the history
When a workorder is processed, it starts the next workorder.
We put that logic in a function to allow other modules to override it.

opw 1943674
  • Loading branch information
Nans Lefebvre committed Mar 11, 2019
1 parent 97ad374 commit 75e7759
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions addons/mrp/models/mrp_workorder.py
Expand Up @@ -338,8 +338,7 @@ def record_production(self):
move_line.done_wo = True

# One a piece is produced, you can launch the next work order
if self.next_work_order_id.state == 'pending':
self.next_work_order_id.state = 'ready'
self._start_nextworkorder()

self.move_line_ids.filtered(
lambda move_line: not move_line.done_move and not move_line.lot_produced_id and move_line.qty_done > 0
Expand Down Expand Up @@ -410,6 +409,12 @@ def record_production(self):
self.button_finish()
return True

@api.multi
def _start_nextworkorder(self):
for record in self:
if record.next_work_order_id.state == 'pending':
record.next_work_order_id.state = 'ready'

@api.multi
def button_start(self):
self.ensure_one()
Expand Down

0 comments on commit 75e7759

Please sign in to comment.