changeset 48a77c56efac in modules/stock_product_location:default
details: 
https://hg.tryton.org/modules/stock_product_location?cmd=changeset;node=48a77c56efac
description:
        Unify _get_inventory_move on shipment

        Define them as instance method to provide more flexibility.

        issue8255
        review287251002
diffstat:

 location.py |  17 ++++++-----------
 1 files changed, 6 insertions(+), 11 deletions(-)

diffs (33 lines):

diff -r cede48d89c94 -r 48a77c56efac location.py
--- a/location.py       Sun Apr 07 19:50:04 2019 +0200
+++ b/location.py       Thu Apr 11 18:54:55 2019 +0200
@@ -44,23 +44,18 @@
 class ShipmentIn(metaclass=PoolMeta):
     __name__ = 'stock.shipment.in'
 
-    @classmethod
-    def _get_inventory_moves(cls, incoming_move):
-        move = super(ShipmentIn, cls)._get_inventory_moves(incoming_move)
+    def _get_inventory_move(self, incoming_move):
+        move = super()._get_inventory_move(incoming_move)
         if move:
-            move.set_product_location(
-                warehouse=incoming_move.shipment.warehouse.id)
+            move.set_product_location(warehouse=self.warehouse.id)
         return move
 
 
 class ShipmentOutReturn(metaclass=PoolMeta):
     __name__ = 'stock.shipment.out.return'
 
-    @classmethod
-    def _get_inventory_moves(cls, incoming_move):
-        move = super(ShipmentOutReturn, cls)._get_inventory_moves(
-            incoming_move)
+    def _get_inventory_move(self, incoming_move):
+        move = super()._get_inventory_move(incoming_move)
         if move:
-            move.set_product_location(
-                warehouse=incoming_move.shipment.warehouse.id)
+            move.set_product_location(warehouse=self.warehouse.id)
         return move

Reply via email to