diff --git a/product/ERP5/Document/Inventory.py b/product/ERP5/Document/Inventory.py
index 29d734bc541c722d4995fded609e95ef9e217b57..df4e0ceafad523c971eeb9e5e404a096dd819488 100644
--- a/product/ERP5/Document/Inventory.py
+++ b/product/ERP5/Document/Inventory.py
@@ -80,7 +80,7 @@ class Inventory(Delivery):
       node = self.getDestination()
       for movement in self.getMovementList():
         resource =  movement.getResourceValue()
-        if resource is not None and movement.getInventory() not in (None,''):
+        if resource is not None and movement.getQuantity() not in (None,''):
           variation_text = movement.getVariationText()
           if (resource,variation_text) not in resource_and_variation_list:
             resource_and_variation_list.append((resource,variation_text))
@@ -101,7 +101,7 @@ class Inventory(Delivery):
                 sub_variation_list = inventory.sub_variation_text.split('\n')
               category_list = self.getCategoryList()
               if inventory.total_quantity != 0:
-                temp_delivery_line = newTempDeliveryLine(self, 
+                temp_delivery_line = newTempDeliveryLine(self,
                                                          self.getId())
                 kwd['quantity'] = - inventory.total_quantity
                 category_list.append('resource/%s' % inventory.resource_relative_url)
@@ -113,11 +113,10 @@ class Inventory(Delivery):
       object_list = [self]
       self.portal_catalog.catalogObjectList(object_list)
       if len(stock_object_list)==0:
-        # Make sure to remove all lines 
+        # Make sure to remove all lines
         from Products.ERP5Type.Document import newTempBase
         stock_object_list.append(newTempDeliveryLine(self,self.getId(),
                                  uid=self.getUid()))
-      #LOG('stock_object_list',0,[x.__dict__ for x in stock_object_list])
       self.portal_catalog.catalogObjectList(stock_object_list,
            method_id_list=('z_catalog_stock_list',),
            disable_cache=1,check_uid=0)