[FIX] stock: Cannot add company to push/pull rules

When creating a rule, the company of the route must be taken when
the route has a company.

opw:1903996

closes odoo/odoo#28387
This commit is contained in:
Goffin Simon
2018-11-05 08:52:11 +00:00
parent 536c65bc7c
commit f7aa7cebf9
+2 -1
View File
@@ -81,7 +81,8 @@ class StockRule(models.Model):
@api.onchange('route_id', 'company_id')
def _onchange_route(self):
""" Ensure that the rule's company is the same than the route's company. """
self.company_id = self.route_id.company_id
if self.route_id.company_id:
self.company_id = self.route_id.company_id
if self.picking_type_id.warehouse_id.company_id != self.route_id.company_id:
self.picking_type_id = False
domain = {'company_id': self.route_id.company_id and [('id', '=', self.route_id.company_id.id)] or []}