diff --git a/addons/mrp/models/mrp_workorder.py b/addons/mrp/models/mrp_workorder.py index dbc0ee221c2..fc0da1ecdab 100644 --- a/addons/mrp/models/mrp_workorder.py +++ b/addons/mrp/models/mrp_workorder.py @@ -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): diff --git a/addons/mrp/tests/test_workorder_operation.py b/addons/mrp/tests/test_workorder_operation.py index 00541dfc8df..14eb7a65b31 100644 --- a/addons/mrp/tests/test_workorder_operation.py +++ b/addons/mrp/tests/test_workorder_operation.py @@ -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)