changeset 0ea0d4ca3fe4 in modules/stock:default
details: https://hg.tryton.org/modules/stock?cmd=changeset;node=0ea0d4ca3fe4
description:
Unify _get_inventory_move on shipment
Define them as instance method to provide more flexibility.
issue8255
review287251002
diffstat:
shipment.py | 16 ++++++++--------
1 files changed, 8 insertions(+), 8 deletions(-)
diffs (61 lines):
diff -r 33f71134bb6c -r 0ea0d4ca3fe4 shipment.py
--- a/shipment.py Sun Apr 07 19:50:04 2019 +0200
+++ b/shipment.py Thu Apr 11 18:54:55 2019 +0200
@@ -377,8 +377,8 @@
default.setdefault('done_by', None)
return super(ShipmentIn, cls).copy(shipments, default=default)
- @classmethod
- def _get_inventory_moves(cls, incoming_move):
+ def _get_inventory_move(self, incoming_move):
+ 'Return inventory move for the incoming move'
pool = Pool()
Move = pool.get('stock.move')
if incoming_move.quantity <= 0.0:
@@ -388,7 +388,7 @@
move.uom = incoming_move.uom
move.quantity = incoming_move.quantity
move.from_location = incoming_move.to_location
- move.to_location = incoming_move.shipment.warehouse_storage
+ move.to_location = self.warehouse_storage
move.state = Move.default_state()
# Product will be considered in stock only when the inventory
# move will be made:
@@ -407,7 +407,7 @@
# moves, it will reset also the incoming_moves
moves = list(shipment.moves)
for incoming_move in shipment.incoming_moves:
- move = cls._get_inventory_moves(incoming_move)
+ move = shipment._get_inventory_move(incoming_move)
if move:
moves.append(move)
shipment.moves = moves
@@ -1729,8 +1729,8 @@
Move.cancel([m for s in shipments
for m in s.incoming_moves + s.inventory_moves])
- @staticmethod
- def _get_inventory_moves(incoming_move):
+ def _get_inventory_move(self, incoming_move):
+ 'Return inventory move for the incoming move'
pool = Pool()
Move = pool.get('stock.move')
if incoming_move.quantity <= 0.0:
@@ -1740,7 +1740,7 @@
move.uom = incoming_move.uom
move.quantity = incoming_move.quantity
move.from_location = incoming_move.to_location
- move.to_location = incoming_move.shipment.warehouse_storage
+ move.to_location = self.warehouse_storage
move.state = Move.default_state()
# Product will be considered in stock only when the inventory
# move will be made:
@@ -1759,7 +1759,7 @@
# moves, it will reset also the incoming_moves
moves = list(shipment.moves)
for incoming_move in shipment.incoming_moves:
- move = cls._get_inventory_moves(incoming_move)
+ move = shipment._get_inventory_move(incoming_move)
if move:
moves.append(move)
shipment.moves = moves