Commit 6cb32f44 authored by Alexandre Boeglin's avatar Alexandre Boeglin

set DeliveryError on simulation movement, so that the Delivery can converge

even if there is a floating point rounding error (99.0/98.0*98.0 != 99.0).


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@7361 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 6ef45abd
......@@ -100,15 +100,18 @@ class CopyToTarget(TargetSolver):
parent_movement = None
return parent_movement, value_delta_dict
def _recursivelySolve(self, simulation_movement, **value_delta_dict):
def _recursivelySolve(self, simulation_movement, is_last_movement=1, **value_delta_dict):
"""
Update value of the current simulation movement, and update
his parent movement.
"""
value_dict = self._generateValueDict(simulation_movement, **value_delta_dict)
simulation_movement.edit(**value_dict)
if is_last_movement:
delivery_quantity = simulation_movement.getDeliveryValue().getQuantity()
simulation_movement.setDeliveryError(delivery_quantity - value_dict['quantity'])
parent_movement, parent_value_delta_dict = \
self._getParentParameters(simulation_movement, **value_delta_dict)
if parent_movement is not None:
# Modify the parent movement
self._recursivelySolve(parent_movement, **parent_value_delta_dict)
self._recursivelySolve(parent_movement, is_last_movement=0, **parent_value_delta_dict)
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