[REV] mrp: revert commit fe508c6

This reverts the following commits : https://github.com/odoo/odoo/commit/fe508c6b2cb1b92d7b063cc194a3dad37f4eb255

The behavior for tracked products is different; the quantity is modified
in a wizard by adding other `stock.move.line`, which does not trigger
the change of the 'picked' field to true and makes the behavior
different from non-tracked products.

We prefer to remove this fix and keep the same behavior for all types
of products. The user can manually select the checkbox for the 'picked'
field.

Update the optional show for the field “picked” in the MO form

closes odoo/odoo#147695

Signed-off-by: Arnold Moyaux (arm) <arm@odoo.com>
This commit is contained in:
Djamel Touati
2023-12-29 16:10:46 +00:00
parent 5054148633
commit 705b256b8c
5 changed files with 9 additions and 6 deletions
-2
View File
@@ -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
@@ -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 });
}
}
@@ -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()",
+3 -2
View File
@@ -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)
+1 -1
View File
@@ -408,7 +408,7 @@
force_save="1" widget="mrp_consumed"/>
<field name="product_uom" readonly="state != 'draft' and id" options="{'no_open': True, 'no_create': True}" groups="uom.group_uom"/>
<!-- TODO put forecast back -->
<field name="picked" string="Consumed" column_invisible="parent.state == 'draft'" optional="hide"/>
<field name="picked" string="Consumed" column_invisible="parent.state == 'draft'" optional="show"/>
<field name="manual_consumption" column_invisible="True" force_save="1"/>
<field name="show_details_visible" column_invisible="True"/>
<field name="lot_ids" widget="many2many_tags"