[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
This commit is contained in:
Denis Ledoux
2018-05-07 17:02:02 +02:00
parent b8006bfb1c
commit a8ab14a672
+1 -1
View File
@@ -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(