[REF] mrp: inventory post when last work order is finished
Before this patch, the inventory was automatically posted when you click on "done" on the last planned work order. This behavior was preventing the user from correcting, for example, the consumed quantity on the raw materials move on the manufacturing order if it was different from the theoretical quantity. Note that finishing anyone but the last work order still let you edit the consumed quantity. Same with changing the lot. Now you have to click on "mark as done" on the manufacturing order to post the inventory. Note that this is the same behavior when working without work order (produce > mark as done will post). We adapt the tests to reflect this change.
This commit is contained in:
committed by
Simon Lejeune
parent
78646696b8
commit
c2040da0ba
@@ -377,8 +377,6 @@ class MrpWorkorder(models.Model):
|
||||
self.ensure_one()
|
||||
self.end_all()
|
||||
self.write({'state': 'done', 'date_finished': fields.Datetime.now()})
|
||||
if not self.production_id.workorder_ids.filtered(lambda x: x.state not in ('done','cancel')):
|
||||
self.production_id.post_inventory() # User should put it to done manually
|
||||
|
||||
@api.multi
|
||||
def end_previous(self, doall=False):
|
||||
|
||||
@@ -123,9 +123,10 @@ class TestWorkOrderProcess(common.TransactionCase):
|
||||
# This behaviour was changed
|
||||
#self.assertEqual(production_table.state, 'done', "Production order should be in done state.")
|
||||
|
||||
# ----------------------------------------
|
||||
# Check consume quants and produce quants.
|
||||
# ----------------------------------------
|
||||
# ---------------------------------------------------------------
|
||||
# Check consume quants and produce quants after posting inventory
|
||||
# ---------------------------------------------------------------
|
||||
production_table.button_mark_done()
|
||||
self.assertEqual(sum(move_table_sheet.quant_ids.mapped('qty')), 1, "Wrong quantity of consumed product %s" % move_table_sheet.product_id.name)
|
||||
self.assertEqual(sum(move_leg.quant_ids.mapped('qty')), 4, "Wrong quantity of consumed product %s" % move_leg.product_id.name)
|
||||
self.assertEqual(sum(move_table_bolt.quant_ids.mapped('qty')), 4, "Wrong quantity of consumed product %s" % move_table_bolt.product_id.name)
|
||||
|
||||
Reference in New Issue
Block a user