Commit 2be90dd3 authored by Jean-Paul Smets's avatar Jean-Paul Smets

getQuantity now takes into account pas movements in same node/section


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@365 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 91354e04
......@@ -180,11 +180,21 @@ Une ligne tarifaire."""
quantity = self._baseGetQuantity()
if quantity not in (0.0, 0, None):
return quantity
return self.getInventory()
# Find total of movements in the past - XXX
current_inventory = self.InventoryLine_zGetInventoryList(
section_uid = self.getDestinationSectionUid(), node_uid = getDestinationUid())[0].inventory
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(
at_date = self.getStartDate(),
variation_text = self.getVariationText(),
node = self.getDestination(),
section = self.getDestinationSection())
inventory = self.getInventory()
if inventory in (None, ''):
return None # Do not change inventory if no inventory value provided
return self.getInventory() - current_inventory
return self.getInventory()
def _setItemIdList(self, value):
"""
......
......@@ -153,9 +153,20 @@ Une ligne tarifaire."""
return quantity
return self.getInventory()
# Find total of movements in the past - XXX
current_inventory = self.InventoryLine_zGetInventoryList(
section_uid = self.getDestinationSectionUid(), node_uid = getDestinationUid())[0].inventory
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(
at_date = self.getStartDate(),
variation_text = self.getVariationText(),
node = self.getDestination(),
section = self.getDestinationSection())
inventory = self.getInventory()
if inventory in (None, ''):
return None # Do not change inventory if no inventory value provided
return self.getInventory() - current_inventory
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