From ecaf5f66e1aefd9f80a8f335f458de7aa3321ac2 Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Tue, 26 Dec 2017 13:27:24 +0100 Subject: [PATCH] [FIX] stock: wrong company when creating a route Routes created when creating companie were not set to the correct company. Steps to reproduce: - Go to Settings > General settings: Activate Manage Multiple companies. - Go in Inventory > Configuration>Settings: Click "Manage several Warehouses, each one composed by several stock location". Click "Advanced routing of products using rules". - Go in Settings > Users > Companies: Create new companie "ThisNewCompanie" - Go in Inventory > Configuration>Routes: Open Routes named ThisNewCompanie. Bug: All the routes created automatically by creating the company "ThisNewCompanie" are not set to the company "ThisNewCompanie". They are set to the company of the logged user when "ThisNewCompanie" was created opw:787229 --- addons/stock/models/stock_warehouse.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/addons/stock/models/stock_warehouse.py b/addons/stock/models/stock_warehouse.py index b112d11567b..b132083138e 100644 --- a/addons/stock/models/stock_warehouse.py +++ b/addons/stock/models/stock_warehouse.py @@ -427,6 +427,7 @@ class Warehouse(models.Model): self.Routing(warehouse.lot_stock_id, warehouse.wh_pack_stock_loc_id, warehouse.pick_type_id), self.Routing(warehouse.wh_pack_stock_loc_id, warehouse.wh_output_stock_loc_id, warehouse.pack_type_id), self.Routing(warehouse.wh_output_stock_loc_id, customer_loc, warehouse.out_type_id)], + 'company_id': warehouse.company_id.id, }) for warehouse in self) @api.multi @@ -436,6 +437,7 @@ class Warehouse(models.Model): 'product_categ_selectable': True, 'product_selectable': False, 'sequence': 10, + 'company_id': self.company_id.id, } @api.model @@ -455,7 +457,8 @@ class Warehouse(models.Model): 'product_selectable': True, 'product_categ_selectable': True, 'supplied_wh_id': self.id, - 'supplier_wh_id': supplier_warehouse.id} + 'supplier_wh_id': supplier_warehouse.id, + 'company_id': self.company_id.id} def _get_inter_wh_route(self, supplier_warehouse): # FIXME - remove me in master/saas-14 @@ -469,7 +472,8 @@ class Warehouse(models.Model): 'product_selectable': True, 'product_categ_selectable': True, 'active': self.delivery_steps != 'ship_only' and self.reception_steps != 'one_step', - 'sequence': 20} + 'sequence': 20, + 'company_id': self.company_id.id} def _get_crossdock_route(self, route_name): # FIXME - remove me in master/saas-14