Commit e85f1425 authored by Sebastien Robin's avatar Sebastien Robin

do not call getInventory any more when calling getQuantity


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@4800 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 04c6f717
...@@ -104,22 +104,6 @@ class InventoryCell(DeliveryCell): ...@@ -104,22 +104,6 @@ class InventoryCell(DeliveryCell):
# Make sure inventory is defined somewhere (here or parent) # Make sure inventory is defined somewhere (here or parent)
if getattr(aq_base(self), 'inventory', None) is None: if getattr(aq_base(self), 'inventory', None) is None:
return 0.0 # No inventory defined, so no quantity return 0.0 # No inventory defined, so no quantity
# Find total of movements in the past - XXX
resource_value = self.getResourceValue()
if resource_value is not None:
# Inventories can only be done in "real" locations / sectinos, not categories thereof
# -> therefore we use node and section
current_inventory = resource_value.getInventory( \
to_date = self.getStartDate()
, variation_text = self.getVariationText()
, node = self.getDestination()
, section_category = self.getDestinationSection()
, simulation_state = self.getPortalCurrentInventoryStateList()
)
inventory = self.getInventory()
if current_inventory in (None, ''):
current_inventory = 0.0
return self.getInventory() - current_inventory
return self.getInventory() return self.getInventory()
else: else:
return None return None
......
...@@ -113,22 +113,6 @@ class InventoryLine(DeliveryLine): ...@@ -113,22 +113,6 @@ class InventoryLine(DeliveryLine):
# Make sure inventory is defined somewhere (here or parent) # Make sure inventory is defined somewhere (here or parent)
if getattr(aq_base(self), 'inventory', None) is None: if getattr(aq_base(self), 'inventory', None) is None:
return 0.0 # No inventory defined, so no quantity return 0.0 # No inventory defined, so no quantity
# Find total of movements in the past - XXX
resource_value = self.getResourceValue()
if resource_value is not None:
# Inventories can only be done in "real" locations / sectinos, not categories thereof
# -> therefore we use node and section
current_inventory = resource_value.getInventory( \
to_date = self.getStartDate()
, variation_text = self.getVariationText()
, node = self.getDestination()
, section = self.getDestinationSection() #section_category
, simulation_state = self.getPortalCurrentInventoryStateList()
)
inventory = self.getInventory()
if current_inventory in (None, ''):
current_inventory = 0.0
return self.getInventory() - current_inventory
return self.getInventory() return self.getInventory()
else: else:
return None 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