From a8ab14a67263d094daa816557216087a4f680f80 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Thu, 3 May 2018 12:22:10 +0200 Subject: [PATCH] [FIX] stock: prevent to create the reception route over and over when deleted once When the reception route of a warehouse company is deleted by the user e.g. My company, Chicago Receipt in 1 step is deleted, and then changing the given warehouse `Incoming Shipments` multiple times e.g. from `one_step` to `two_steps` multiple time, the reception route is created again and again and again. This is because the reception route which is created for the warehouse is not being assigned to the warehouse as the `reception_route_id` once newly created. opw-1836544 --- 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 a1516d82ac0..61bba824328 100644 --- a/addons/stock/models/stock_warehouse.py +++ b/addons/stock/models/stock_warehouse.py @@ -285,7 +285,7 @@ class Warehouse(models.Model): reception_route.pull_ids.unlink() reception_route.push_ids.unlink() else: - reception_route = self.env['stock.location.route'].create(warehouse._get_reception_delivery_route_values(warehouse.reception_steps)) + warehouse.reception_route_id = reception_route = self.env['stock.location.route'].create(warehouse._get_reception_delivery_route_values(warehouse.reception_steps)) # push / procurement (pull) rules for reception routings = routes_data[warehouse.id][warehouse.reception_steps] push_rules_list, pull_rules_list = warehouse._get_push_pull_rules_values(