Skip to content
Permalink
Browse files

[FIX] mrp: start the next workorder in a function to allow for overrides

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...
len-odoo committed Mar 11, 2019
1 parent 8a7dc81 commit 208b8ebdb0799b78bcb107d73502d3e71a4659b2
Showing with 7 additions and 2 deletions.
  1. +7 −2 addons/mrp/models/mrp_workorder.py
@@ -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
@@ -409,6 +408,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()

0 comments on commit 208b8eb

Please sign in to comment.
You can’t perform that action at this time.