trytond-patches/issue11574.diff

26 lines
1.2 KiB
Diff

diff --git a/tryton/modules/stock/shipment.py b/tryton/modules/stock/shipment.py
index 422e94aa10..e89a68a54e 100644
--- a/tryton/modules/stock/shipment.py
+++ b/tryton/modules/stock/shipment.py
@@ -625,6 +625,9 @@ class ShipmentInReturn(ShipmentAssignMixin, Workflow, ModelSQL, ModelView):
'readonly': (Eval('state') != 'draft') | Eval('moves', [0]),
}, domain=[('type', '=', 'supplier')],
help="Where the stock is moved to.")
+ warehouse = fields.Function(
+ fields.Many2One('stock.location', "Warehouse"),
+ 'on_change_with_warehouse')
moves = fields.One2Many('stock.move', 'shipment', 'Moves',
states={
'readonly': (((Eval('state') != 'draft') | ~Eval('from_location'))
@@ -744,6 +747,10 @@ class ShipmentInReturn(ShipmentAssignMixin, Workflow, ModelSQL, ModelView):
self.delivery_address = self.supplier.address_get('delivery')
self.to_location = self.supplier.supplier_location
+ @fields.depends('from_location')
+ def on_change_with_warehouse(self, name=None):
+ return self.from_location.warehouse if self.from_location else None
+
@property
def _move_planned_date(self):
'''