changeset 532ecf3087f9 in modules/stock:default
details: https://hg.tryton.org/modules/stock?cmd=changeset&node=532ecf3087f9
description:
        Add stock_quantity_issue module

        issue9944
        review339291003
diffstat:

 shipment.py |  10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diffs (27 lines):

diff -r 620a7c847b2d -r 532ecf3087f9 shipment.py
--- a/shipment.py       Thu Mar 18 23:04:18 2021 +0100
+++ b/shipment.py       Sun Mar 21 12:52:58 2021 +0100
@@ -1988,6 +1988,11 @@
             help="Where the stock is located while it is in transit between "
             "the warehouses."),
         'on_change_with_transit_location')
+    warehouse = fields.Function(
+        fields.Many2One(
+            'stock.location', "Warehouse",
+            help="Where the stock is sent from."),
+        'on_change_with_warehouse')
     moves = fields.One2Many('stock.move', 'shipment', 'Moves',
         states={
             'readonly': (Eval('state').in_(['cancelled', 'assigned', 'done'])
@@ -2206,6 +2211,11 @@
         if self.planned_date != self.planned_start_date:
             return Config(1).get_multivalue('shipment_internal_transit').id
 
+    @fields.depends('from_location')
+    def on_change_with_warehouse(self, name=None):
+        if self.from_location and self.from_location.warehouse:
+            return self.from_location.warehouse.id
+
     @fields.depends('planned_date', 'from_location', 'to_location')
     def on_change_with_planned_start_date(self, pattern=None):
         pool = Pool()

Reply via email to