From 780c00dd282e83d9f9d055a8864af9d70e229f98 Mon Sep 17 00:00:00 2001 From: svs-odoo Date: Wed, 28 Sep 2022 13:45:13 +0000 Subject: [PATCH] [FIX] stock: warehouse delivery steps Since that commit: dd7f4d501a4d23b04a1899be8fd51cc583673c9d A picking type cannot make the scan of the source location mandatory if the scan of the destination source is optional. An error is raised in case the user tries to edit and save a picking types with this erronous config but there is also an issue if the user tries to set the outgoing shipments in 2 or 3 steps. The method `_create_or_update_sequences_and_picking_types` was the cause of this issue because of an `update` on the `stock.picking.type`. We try to update `restrict_scan_source_location` to "mandatory" and `restrict_scan_dest_location` to "no" for the pick operation, the issue is with `update`, each field is write one by one, and so, it will write on `restrict_scan_source_location` first while `restrict_scan_dest_location` is still set on "optional". To fix that, we replace the `update` by a `write`. closes odoo/odoo#101663 X-original-commit: 07fb4af8c68ae1296e796c2f3714823ed828e680 Signed-off-by: Arnold Moyaux (arm) Signed-off-by: Steve Van Essche --- addons/stock/models/stock_warehouse.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/stock/models/stock_warehouse.py b/addons/stock/models/stock_warehouse.py index 64bbde36869..7f4820ec750 100644 --- a/addons/stock/models/stock_warehouse.py +++ b/addons/stock/models/stock_warehouse.py @@ -336,7 +336,7 @@ class Warehouse(models.Model): for picking_type, values in data.items(): if self[picking_type]: - self[picking_type].update(values) + self[picking_type].write(values) else: data[picking_type].update(create_data[picking_type]) sequence = IrSequenceSudo.create(sequence_data[picking_type])