Commit c329d7d8 authored by Yoshinori Okuji's avatar Yoshinori Okuji

Copy dates rather than patching deltas, because floating points are not so...

Copy dates rather than patching deltas, because floating points are not so reliable for milliseconds. This should be probably applied to CopyToTarget as well.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@15615 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 0139604c
...@@ -51,16 +51,16 @@ class ResourceBackpropagation(CopyToTarget): ...@@ -51,16 +51,16 @@ class ResourceBackpropagation(CopyToTarget):
quantity_ratio = 0 quantity_ratio = 0
if old_quantity not in (None,0.0): # XXX: What if quantity happens to be an integer ? if old_quantity not in (None,0.0): # XXX: What if quantity happens to be an integer ?
quantity_ratio = new_quantity / old_quantity quantity_ratio = new_quantity / old_quantity
start_date_delta = 0 start_date = None
stop_date_delta = 0 stop_date = None
if new_start_date is not None and old_start_date is not None: if new_start_date is not None and old_start_date is not None:
start_date_delta = new_start_date - old_start_date start_date = new_start_date
if new_stop_date is not None and old_stop_date is not None: if new_stop_date is not None and old_stop_date is not None:
stop_date_delta = new_stop_date - old_stop_date stop_date = new_stop_date
return { return {
'quantity_ratio': quantity_ratio, 'quantity_ratio': quantity_ratio,
'start_date_delta': start_date_delta, 'start_date': start_date,
'stop_date_delta': stop_date_delta, 'stop_date': stop_date,
'resource_list' : 'resource_list' :
simulation_movement.getDeliveryValue().getResourceList(), simulation_movement.getDeliveryValue().getResourceList(),
'variation_category_list': 'variation_category_list':
...@@ -70,7 +70,7 @@ class ResourceBackpropagation(CopyToTarget): ...@@ -70,7 +70,7 @@ class ResourceBackpropagation(CopyToTarget):
} }
def _generateValueDict(self, simulation_movement, quantity_ratio=1, def _generateValueDict(self, simulation_movement, quantity_ratio=1,
start_date_delta=0, stop_date_delta=0, start_date=None, stop_date=None,
resource_list=[], resource_list=[],
variation_category_list=[], variation_category_list=[],
variation_property_dict={}, variation_property_dict={},
...@@ -80,12 +80,10 @@ class ResourceBackpropagation(CopyToTarget): ...@@ -80,12 +80,10 @@ class ResourceBackpropagation(CopyToTarget):
""" """
value_dict = {} value_dict = {}
# Modify quantity, start_date, stop_date # Modify quantity, start_date, stop_date
start_date = simulation_movement.getStartDate()
if start_date is not None: if start_date is not None:
value_dict['start_date'] = start_date + start_date_delta value_dict['start_date'] = start_date
stop_date = simulation_movement.getStopDate()
if stop_date is not None: if stop_date is not None:
value_dict['stop_date'] = stop_date + stop_date_delta value_dict['stop_date'] = stop_date
value_dict['quantity'] = simulation_movement.getQuantity() * quantity_ratio value_dict['quantity'] = simulation_movement.getQuantity() * quantity_ratio
if resource_list: if resource_list:
value_dict['resource_list'] = resource_list value_dict['resource_list'] = resource_list
......
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