Commit adb195f2 authored by Romain Courteaud's avatar Romain Courteaud

Calculate start_date and stop_date for the created Simulation Movement.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@3440 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent e95d053d
...@@ -147,6 +147,7 @@ class TransformationRule(Rule): ...@@ -147,6 +147,7 @@ class TransformationRule(Rule):
Only one produced movement can be created. Only one produced movement can be created.
""" """
parent_movement = applied_rule.getParent() parent_movement = applied_rule.getParent()
stop_date = parent_movement.getStartDate()
produced_movement_dict = { produced_movement_dict = {
'pr': { 'pr': {
"resource": parent_movement.getResource(), "resource": parent_movement.getResource(),
...@@ -160,9 +161,8 @@ class TransformationRule(Rule): ...@@ -160,9 +161,8 @@ class TransformationRule(Rule):
"destination": production, "destination": production,
"destination_section": production_section, "destination_section": production_section,
"deliverable": 1, "deliverable": 1,
# XXX FIXME date not implemented 'start_date': current_supply_link.getStartDate(stop_date),
# "start_date": parent_movement.getStartDate(), 'stop_date': stop_date,
# "stop_date": parent_movement.getStartDate(),
'causality_value': current_supply_link, 'causality_value': current_supply_link,
} }
} }
...@@ -213,10 +213,10 @@ class TransformationRule(Rule): ...@@ -213,10 +213,10 @@ class TransformationRule(Rule):
for ind_phase_value in previous_ind_phase_list: for ind_phase_value in previous_ind_phase_list:
ind_phase = ind_phase_value.getLogicalPath() ind_phase = ind_phase_value.getLogicalPath()
consumed_mvt_id = "%s_%s" % ("mr", ind_phase_value.getId()) consumed_mvt_id = "%s_%s" % ("mr", ind_phase_value.getId())
stop_date = parent_movement.getStartDate()
consumed_movement_dict[consumed_mvt_id] = { consumed_movement_dict[consumed_mvt_id] = {
# XXX FIXME: Not yet implemented 'start_date': current_supply_link.getStartDate(stop_date),
# start_date = parent_movement.getStartDate(), 'stop_date': stop_date,
# stop_date = parent_movement.getStartDate(),
"resource": parent_movement.getResource(), "resource": parent_movement.getResource(),
# XXX Is the quantity value correct ? # XXX Is the quantity value correct ?
"quantity": parent_movement.getQuantity(), "quantity": parent_movement.getQuantity(),
...@@ -267,10 +267,10 @@ class TransformationRule(Rule): ...@@ -267,10 +267,10 @@ class TransformationRule(Rule):
consumed_movement_dict = {} consumed_movement_dict = {}
for amount in amount_list: for amount in amount_list:
consumed_mvt_id = "%s_%s" % ("cr", amount.getId()) consumed_mvt_id = "%s_%s" % ("cr", amount.getId())
stop_date = parent_movement.getStartDate()
consumed_movement_dict[consumed_mvt_id] = { consumed_movement_dict[consumed_mvt_id] = {
# XXX FIXME date not implemented 'start_date': current_supply_link.getStartDate(stop_date),
# "start_date": movement.getStartDate(), 'stop_date': stop_date,
# "stop_date": movement.getStartDate(),
"resource": amount.getResource(), "resource": amount.getResource(),
"variation_category_list":\ "variation_category_list":\
amount.getVariationCategoryList(), amount.getVariationCategoryList(),
......
...@@ -181,6 +181,7 @@ class TransformationSourcingRule(Rule): ...@@ -181,6 +181,7 @@ class TransformationSourcingRule(Rule):
if source_node is not None: if source_node is not None:
source_value = source_node.getDestinationValue() source_value = source_node.getDestinationValue()
# Generate the dict # Generate the dict
stop_date = parent_movement.getStartDate()
movement_dict.update({ movement_dict.update({
"ts": { "ts": {
'source_value': source_value, 'source_value': source_value,
...@@ -190,9 +191,8 @@ class TransformationSourcingRule(Rule): ...@@ -190,9 +191,8 @@ class TransformationSourcingRule(Rule):
getVariationCategoryList(), getVariationCategoryList(),
'quantity': parent_movement.getQuantity(), 'quantity': parent_movement.getQuantity(),
'quantity_unit': parent_movement.getQuantityUnit(), 'quantity_unit': parent_movement.getQuantityUnit(),
# XXX FIXME not implemented 'start_date': previous_supply_link.getStartDate(stop_date),
# 'start_date': parent_movement.getStartDate(), 'stop_date': stop_date,
# 'stop_date': parent_movement.getStopDate(),
'deliverable': 1, 'deliverable': 1,
# Save the value of the current supply link # Save the value of the current supply link
'causality_value': previous_supply_link, 'causality_value': previous_supply_link,
......
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