Test move from _get_inventory_moves before setting location

issue3530
review2011002
(transplanted from 1a68309d3de62a024703eaa2ae7a3aca79f208e6)
This commit is contained in:
Cédric Krier committed 2013-12-12 13:31:21 +01:00
1 parent a5286b66e7
commit 8b5ede8a58
1 file changed
+11 -9
+11 -9
View File
@@ -52,11 +52,12 @@ class ShipmentIn:
@classmethod
def _get_inventory_moves(cls, incoming_move):
move = super(ShipmentIn, cls)._get_inventory_moves(incoming_move)
for product_location in incoming_move.product.locations:
if product_location.warehouse.id != \
incoming_move.shipment.warehouse.id:
continue
move.to_location = product_location.location
if move:
for product_location in incoming_move.product.locations:
if product_location.warehouse.id != \
incoming_move.shipment.warehouse.id:
continue
move.to_location = product_location.location
return move
@@ -67,8 +68,9 @@ class ShipmentOutReturn:
def _get_inventory_moves(cls, incoming_move):
move = super(ShipmentOutReturn, cls)._get_inventory_moves(
incoming_move)
for product_location in incoming_move.product.locations:
if (product_location.warehouse
== incoming_move.shipment.warehouse):
move.to_location = product_location.location
if move:
for product_location in incoming_move.product.locations:
if (product_location.warehouse
== incoming_move.shipment.warehouse):
move.to_location = product_location.location
return move