From cdf201a1dcef94d9eae706a487fa91645d50d11b Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Tue, 2 Oct 2018 11:39:10 +0200 Subject: [PATCH] [FIX] stock: decrease initial demand quantity - Open a picking (example WH/IN/00002) - Unlock - Edit Initial Demand (from 35 to 4 for example) - Click on Save An error occurs: 'Record does not exist or has been deleted.' When saving, the following values are sent to the server (example): `{'move_ids_without_package': [ [1, 31, {'product_uom_qty': 4, 'date_expected': '2018-10-02 08:27:14'}] ], 'move_line_ids_without_package': [ [1, 26, {'package_id': False, 'result_package_id': False, 'owner_id': False, 'lot_id': False}] ]}` The field `move_ids_without_package` contains the new quantity. However, decreasing the quantity will remove the reservation and therefore unlink the move lines. https://github.com/odoo/odoo/blob/718b0f8b63261e1312b5626d48de050b21a9dccf/addons/stock/models/stock_move_line.py#L349 This means that the field `move_line_ids_without_package` refers to IDs which have been deleted when writing on `move_ids_without_package`. We can make the field read-only if it is not displayed. opw-1889802 --- addons/stock/views/stock_picking_views.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/stock/views/stock_picking_views.xml b/addons/stock/views/stock_picking_views.xml index 14997b7d71d..c506c5f9722 100644 --- a/addons/stock/views/stock_picking_views.xml +++ b/addons/stock/views/stock_picking_views.xml @@ -265,7 +265,7 @@ - +