diff --git a/addons/mrp/models/stock_move.py b/addons/mrp/models/stock_move.py index 5f7c50a9b94..5677ce9ba7b 100644 --- a/addons/mrp/models/stock_move.py +++ b/addons/mrp/models/stock_move.py @@ -292,8 +292,6 @@ class StockMove(models.Model): def write(self, vals): if self.env.context.get('force_manual_consumption'): vals['manual_consumption'] = True - if vals.get('manual_consumption'): - vals['picked'] = True if 'product_uom_qty' in vals and 'move_line_ids' in vals: # first update lines then product_uom_qty as the later will unreserve # so possibly unlink lines diff --git a/addons/mrp/static/src/widgets/mrp_consumed.js b/addons/mrp/static/src/widgets/mrp_consumed.js index 854ca5d0647..2419c84f401 100644 --- a/addons/mrp/static/src/widgets/mrp_consumed.js +++ b/addons/mrp/static/src/widgets/mrp_consumed.js @@ -23,7 +23,7 @@ export class MrpConsumed extends FloatField { } onInput(ev) { - return this.props.record.update({ manual_consumption: true, picked: true }); + return this.props.record.update({ manual_consumption: true }); } } diff --git a/addons/mrp/static/tests/tours/mrp_manual_consumption.js b/addons/mrp/static/tests/tours/mrp_manual_consumption.js index 02b58eda0e2..714a3ffd575 100644 --- a/addons/mrp/static/tests/tours/mrp_manual_consumption.js +++ b/addons/mrp/static/tests/tours/mrp_manual_consumption.js @@ -86,6 +86,10 @@ registry.category("web_tour.tours").add('test_mrp_manual_consumption_02', { trigger: 'div[name="quantity"] input', run: 'text 16.0' }, + { + trigger: 'div[name="picked"] input', + run: 'click', + }, { content: "Click Pager", trigger: ".o_pager_value:first()", diff --git a/addons/mrp/tests/test_manual_consumption.py b/addons/mrp/tests/test_manual_consumption.py index d449a09e831..f91cf38fa95 100644 --- a/addons/mrp/tests/test_manual_consumption.py +++ b/addons/mrp/tests/test_manual_consumption.py @@ -89,6 +89,7 @@ class TestTourManualConsumption(HttpCase): def test_mrp_manual_consumption_02(self): """ test that when a new quantity is manually set for a component, + and the field picked is set to True, and the MO is marked as done, the component quantity is not overwritten. """ Product = self.env['product.product'] @@ -106,7 +107,7 @@ class TestTourManualConsumption(HttpCase): 'product_qty': 1, 'type': 'normal', 'bom_line_ids': [ - (0, 0, {'product_id': product_nt.id, 'product_qty': 1}), + (0, 0, {'product_id': product_nt.id, 'product_qty': 1, 'manual_consumption': True}), ], }) @@ -119,7 +120,7 @@ class TestTourManualConsumption(HttpCase): self.assertEqual(mo.state, 'confirmed') move_nt = mo.move_raw_ids - self.assertEqual(move_nt.manual_consumption, False) + self.assertEqual(move_nt.manual_consumption, True) self.assertEqual(move_nt.quantity, 0) self.assertFalse(move_nt.picked) diff --git a/addons/mrp/views/mrp_production_views.xml b/addons/mrp/views/mrp_production_views.xml index d759e05d840..6b1cf8b26bc 100644 --- a/addons/mrp/views/mrp_production_views.xml +++ b/addons/mrp/views/mrp_production_views.xml @@ -408,7 +408,7 @@ force_save="1" widget="mrp_consumed"/> - +