diff --git a/addons/stock/models/stock_move_line.py b/addons/stock/models/stock_move_line.py index 9f4461d223691de21bf58051fb5ac35066aacc09..c54f50f1fd1bec7f644223feb122a30f3a5e38a1 100644 --- a/addons/stock/models/stock_move_line.py +++ b/addons/stock/models/stock_move_line.py @@ -25,9 +25,11 @@ class StockMoveLine(models.Model): product_id = fields.Many2one('product.product', 'Product', ondelete="cascade") product_uom_id = fields.Many2one('uom.uom', 'Unit of Measure', required=True) product_qty = fields.Float( - 'Real Reserved Quantity', digits=0, + 'Real Reserved Quantity', digits=0, copy=False, compute='_compute_product_qty', inverse='_set_product_qty', store=True) - product_uom_qty = fields.Float('Reserved', default=0.0, digits=dp.get_precision('Product Unit of Measure'), required=True) + product_uom_qty = fields.Float( + 'Reserved', default=0.0, digits=dp.get_precision('Product Unit of Measure'), + copy=False, required=True) qty_done = fields.Float('Done', default=0.0, digits=dp.get_precision('Product Unit of Measure'), copy=False) package_id = fields.Many2one('stock.quant.package', 'Source Package', ondelete='restrict') package_level_id = fields.Many2one('stock.package_level', 'Package Level') diff --git a/addons/stock/tests/test_wise_operator.py b/addons/stock/tests/test_wise_operator.py index 79e638b276884708c8f5963a7ee155570825c4e2..569f9484620c651709ffe930ed8bc6dd6b334498 100644 --- a/addons/stock/tests/test_wise_operator.py +++ b/addons/stock/tests/test_wise_operator.py @@ -129,8 +129,7 @@ class TestWiseOperator(TransactionCase): # put the move lines from delivery_order_wise2 into delivery_order_wise1 for pack_id2 in pack_ids2: new_pack_id1 = pack_id2.copy(default={'picking_id': delivery_order_wise1.id, 'move_id': move1.id}) - new_pack_id1.qty_done = new_pack_id1.product_qty - new_pack_id1.with_context(bypass_reservation_update=True).product_uom_qty = 0 + new_pack_id1.qty_done = pack_id2.product_qty new_move_lines = delivery_order_wise1.move_line_ids.filtered(lambda p: p.qty_done) self.assertEqual(sum(new_move_lines.mapped('product_qty')), 0) @@ -141,8 +140,7 @@ class TestWiseOperator(TransactionCase): # put the move line from delivery_order_wise1 into delivery_order_wise2 new_pack_id2 = pack_ids1.copy(default={'picking_id': delivery_order_wise2.id, 'move_id': move2.id}) - new_pack_id2.qty_done = new_pack_id2.product_qty - new_pack_id2.with_context(bypass_reservation_update=True).product_uom_qty = 0 + new_pack_id2.qty_done = pack_ids1.product_qty new_move_lines = delivery_order_wise2.move_line_ids.filtered(lambda p: p.qty_done) self.assertEqual(len(new_move_lines), 1)