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: ...@@ -463,15 +463,21 @@ class FakeMovement:
def setDeliveryValue(self, object): def setDeliveryValue(self, object):
""" """
Set Delivery value for each movement Set Delivery value for each movement
And calculate delivery_ratio
""" """
for movement in self.__movement_list: for movement in self.__movement_list:
# XXX is delivery_ratio well calculated ? movement.edit(delivery_value=object)
# movement.getQuantity /
# (sum object.getRelatedSimulationMovement.getQuantity) def setDeliveryRatio(self, delivery_ratio):
movement.edit( """
delivery_value=object, Calculate delivery_ratio
delivery_ratio=(movement.getQuantity() / object.getQuantity())) """
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): 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