[IMP] mrp: "produce" wizard should set MO to "in progress" state
This commit is contained in:
@@ -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.')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user