Commit 20e1e5ef authored by Romain Courteaud's avatar Romain Courteaud

Add setDeliveryRatio method on FakeMovement.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@3194 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 8df1709c
......@@ -463,15 +463,21 @@ class FakeMovement:
def setDeliveryValue(self, object):
"""
Set Delivery value for each movement
And calculate delivery_ratio
"""
for movement in self.__movement_list:
# XXX is delivery_ratio well calculated ?
# movement.getQuantity /
# (sum object.getRelatedSimulationMovement.getQuantity)
movement.edit(
delivery_value=object,
delivery_ratio=(movement.getQuantity() / object.getQuantity()))
movement.edit(delivery_value=object)
def setDeliveryRatio(self, delivery_ratio):
"""
Calculate delivery_ratio
"""
total_quantity = 0
for movement in self.__movement_list:
total_quantity += movement.getQuantity()
for movement in self.__movement_list:
quantity = movement.getQuantity()
movement.setDeliveryRatio(quantity*delivery_ratio/total_quantity)
def getPrice(self):
"""
......
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