[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
This commit is contained in:
Goffin Simon
2018-01-02 14:53:58 +01:00
parent e336dc38ca
commit ecaf5f66e1
+6 -2
View File
@@ -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