Commit c4a30b06 authored by Guillaume Michon's avatar Guillaume Michon

Bug fix : use quantity of each item instead of number of items when calculating inventory


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@4607 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 2a6f3250
......@@ -71,11 +71,8 @@ class InventoryCell(DeliveryCell):
DeliveryCell._edit(self, REQUEST=REQUEST, force_update = force_update, **kw)
# Calculate inventory
item_list = self.getAggregateValueList()
if len(item_list) > 0:
inventory = 0
for item in item_list:
if item.getQuantity() not in (None, ''):
inventory += item.getQuantity()
inventory = len(item_list)
if inventory != 0:
self.setInventory(inventory)
......
......@@ -71,11 +71,9 @@ class InventoryLine(DeliveryLine):
DeliveryLine._edit(self, REQUEST=REQUEST, force_update = force_update, **kw)
# Calculate inventory
item_list = self.getAggregateValueList()
if len(item_list) > 0:
inventory = 0
for item in item_list:
if item.getQuantity() not in (None, ''):
inventory += item.getQuantity()
if item_list is not None:
inventory = len(item_list)
if inventory != 0:
self.setInventory(inventory)
......@@ -128,9 +126,7 @@ class InventoryLine(DeliveryLine):
inventory = self.getInventory()
if current_inventory in (None, ''):
current_inventory = 0.0
LOG('return 1', 0, '%s - %s' % (repr(self.getInventory()), repr(current_inventory)))
return self.getInventory() - current_inventory
LOG('return 2', 0, repr(self.getInventory()))
return self.getInventory()
else:
return None
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment