From 421de52d125d12789f7d9634bab5979dca0b52cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 12 Dec 2013 13:31:21 +0100 Subject: [PATCH] Test move from _get_inventory_moves before setting location issue3530 review2011002 (transplanted from 1a68309d3de62a024703eaa2ae7a3aca79f208e6) --- location.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/location.py b/location.py index 984fd1a1c8..2950f22839 100644 --- a/location.py +++ b/location.py @@ -36,11 +36,12 @@ class ShipmentIn(ModelSQL, ModelView): def _get_inventory_moves(self, incoming_move): res = super(ShipmentIn, self)._get_inventory_moves(incoming_move) - for product_location in incoming_move.product.locations: - if product_location.warehouse.id != \ - incoming_move.shipment_in.warehouse.id: - continue - res['to_location'] = product_location.location.id + if res: + for product_location in incoming_move.product.locations: + if product_location.warehouse.id != \ + incoming_move.shipment_in.warehouse.id: + continue + res['to_location'] = product_location.location.id return res ShipmentIn()