[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:
@@ -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 []}
|
||||
|
||||
Reference in New Issue
Block a user