mirror of
https://github.com/OCA/stock-logistics-warehouse.git
synced 2025-01-21 14:27:28 +02:00
[IMP] Warehouse On Change
Since the location and routes depend on the warehouse that is selected on the stock request order, if the warehouse changes then so will the route options. This adds an on change event so if the warehouse changes, then the direction gets cleared and so do the routes on the product lines. This forces the user to properly reset the items using the correct routes for the newly selected warehouse.
This commit is contained in:
committed by
Freni Patel
parent
da741c0d14
commit
bde1a7e063
@@ -23,6 +23,14 @@ class StockRequestOrder(models.Model):
|
||||
# Otherwise the Stock Location of the Warehouse
|
||||
self.location_id = self.warehouse_id.lot_stock_id.id
|
||||
|
||||
@api.onchange('warehouse_id')
|
||||
def _onchange_warehouse_id(self):
|
||||
if self.direction:
|
||||
self.direction = False
|
||||
for stock_request in self.stock_request_ids:
|
||||
if stock_request.route_id:
|
||||
stock_request.route_id = False
|
||||
|
||||
def change_childs(self):
|
||||
super().change_childs()
|
||||
if not self._context.get("no_change_childs", False):
|
||||
|
||||
Reference in New Issue
Block a user