Commit 4126504c authored by Cédric Le Ninivin's avatar Cédric Le Ninivin

erp5_mrp_change_managment: Only the change management that create should invalidate

* The issue was that when a lot of change management had the same effective date, sometimes, fixing the consistency of the change management led to invalidating the one that was the latest one.
* XXX CLN: Maybe some verification on the version would have been better.
parent 8d6b4c9f
......@@ -210,12 +210,6 @@ for template_transformation in template_transformation_list:
message_list.append('Transformation change is not properly applied to %s' % target_transformation.getRelativeUrl())
else:
# Fix consistency
# Invalidate previous transformation
if target_transformation:
portal.portal_workflow.doActionFor(
target_transformation,
'invalidate_action',
comment= "Transformation change %s is changed" % transformation_change.getRelativeUrl())
# No need to create new transformation for invalidated transformation change
if transformation_change_state == 'invalidated':
continue
......@@ -224,6 +218,13 @@ for template_transformation in template_transformation_list:
# Several transformation changes have same effecitve date, only create transformation for the last one
if current_index + 1 != len(transformation_change_list):
continue
# Invalidate previous transformation
# Only the one creating the transformation should be allowed to invalidate past transformation
if target_transformation:
portal.portal_workflow.doActionFor(
target_transformation,
'invalidate_action',
comment= "Transformation change %s is changed" % transformation_change.getRelativeUrl())
# Get list of same transformation change
current_index -= 1
tmp_list = [transformation_change]
......
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