Commit cc249444 authored by Romain Courteaud's avatar Romain Courteaud

Bug fix: the implementation of edit in FakeMovement broke the simulation.

setter method like setDeliveryRatio have to be called on FakeMovement.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@3460 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 01e75962
......@@ -519,12 +519,12 @@ class FakeMovement:
if total_quantity != 0:
for movement in self.__movement_list:
quantity = movement.getQuantity()
movement.setDeliveryRatio(quantity*delivery_ratio/total_quantity)
movement.edit(delivery_ratio=quantity*delivery_ratio/total_quantity)
else:
# Distribute equally ratio to all movement
mvt_ratio = 1 / len(self.__movement_list)
for movement in self.__movement_list:
movement.setDeliveryRatio(mvt_ratio)
movement.edit(delivery_ratio=mvt_ratio)
def getPrice(self):
"""
......@@ -616,8 +616,14 @@ class FakeMovement:
def edit(self, **kw):
"""
Simple call to each movement edit() method
Written in order to call edit in delivery builder,
as it is the generic way to modify object.
"""
for movement in self.getMovementList():
movement.edit(**kw)
for key in kw.keys():
if key == 'delivery_ratio':
self.setDeliveryRatio(kw[key])
elif key == 'delivery_value':
self.setDeliveryValue(kw[key])
else:
raise "FakeMovementError",\
"Could not call edit on Fakeovement with parameters: %r" % key
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