Skip to content
Snippets Groups Projects
Commit 8f44f38b authored by Josse Colpaert's avatar Josse Colpaert
Browse files

[IMP] mrp: "produce" wizard should set MO to "in progress" state

parent 31b3073d
Branches
Tags
No related merge requests found
......@@ -74,6 +74,8 @@ class MrpProductProduce(models.TransientModel):
# Nothing to do for lots since values are created using default data (stock.move.lots)
moves = self.production_id.move_raw_ids
quantity = self.product_qty
if float_compare(quantity, 0, precision_rounding=self.product_uom_id.rounding) <= 0:
raise UserError(_('You should at least produce some quantity'))
for move in moves.filtered(lambda x: x.product_id.tracking == 'none' and x.state not in ('done', 'cancel')):
if move.unit_factor:
move.quantity_done_store += quantity * move.unit_factor
......@@ -84,6 +86,8 @@ class MrpProductProduce(models.TransientModel):
elif move.unit_factor:
move.quantity_done_store += quantity * move.unit_factor
self.check_finished_move_lots()
if self.production_id.state == 'confirmed':
self.production_id.state = 'progress'
return {'type': 'ir.actions.act_window_close'}
@api.multi
......
......@@ -280,7 +280,7 @@ class TestSaleMrpFlow(common.TransactionCase):
mnf_product_d.post_inventory()
# Check state of manufacturing order.
self.assertEqual(mnf_product_d.state, 'confirmed', 'Manufacturing order should still be in confirmed state.')
self.assertEqual(mnf_product_d.state, 'progress', 'Manufacturing order should still be in progress state.')
# Check available quantity of product D.
self.assertEqual(product_d.qty_available, 20, 'Wrong quantity available of product D.')
......@@ -332,7 +332,7 @@ class TestSaleMrpFlow(common.TransactionCase):
mnf_product_a.post_inventory()
# Check state of manufacturing order product A.
self.assertEqual(mnf_product_a.state, 'confirmed', 'Manufacturing order should still be in confirmed state.')
self.assertEqual(mnf_product_a.state, 'progress', 'Manufacturing order should still be in the progress state.')
# Check product A avaialble quantity should be 120.
self.assertEqual(product_a.qty_available, 120, 'Wrong quantity available of product A.')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment