Commit 680287ae authored by Łukasz Nowak's avatar Łukasz Nowak

Postpone setting causality on Simulation Movements.

During expand check if movement is buildable and only then allow to set
causality link to Business Process.
parent 1289513a
...@@ -162,11 +162,13 @@ class MovementCollectionUpdaterMixin: ...@@ -162,11 +162,13 @@ class MovementCollectionUpdaterMixin:
movement_diff = self.getMovementCollectionDiff(context, movement_diff = self.getMovementCollectionDiff(context,
rounding=rounding, movement_generator=movement_generator) rounding=rounding, movement_generator=movement_generator)
modified_movement_list = []
# Apply Diff # Apply Diff
for movement in movement_diff.getDeletableMovementList(): for movement in movement_diff.getDeletableMovementList():
movement.getParentValue().deleteContent(movement.getId()) movement.getParentValue().deleteContent(movement.getId())
for movement, kw in movement_diff.getUpdatableMovementList(): for movement, kw in movement_diff.getUpdatableMovementList():
movement.edit(**kw) movement.edit(**kw)
modified_movement_list.append(movement)
for property_id in kw: for property_id in kw:
movement.clearRecordedProperty(property_id) movement.clearRecordedProperty(property_id)
for movement in movement_diff.getNewMovementList(): for movement in movement_diff.getNewMovementList():
...@@ -174,8 +176,9 @@ class MovementCollectionUpdaterMixin: ...@@ -174,8 +176,9 @@ class MovementCollectionUpdaterMixin:
assert movement.isTempObject() assert movement.isTempObject()
if '_original' in d: if '_original' in d:
# slow but safe way (required for compensated movements) # slow but safe way (required for compensated movements)
context.newContent(portal_type=self.movement_type, modified_movement_list.append(context.newContent(
**_getPropertyAndCategoryList(movement)) portal_type=self.movement_type,
**_getPropertyAndCategoryList(movement)))
continue continue
# fast way (we had to make sure such optimization # fast way (we had to make sure such optimization
# does not touch existing persistent data) # does not touch existing persistent data)
...@@ -183,3 +186,9 @@ class MovementCollectionUpdaterMixin: ...@@ -183,3 +186,9 @@ class MovementCollectionUpdaterMixin:
movement = context.newContent(portal_type=self.movement_type) movement = context.newContent(portal_type=self.movement_type)
d.update(movement.__dict__) d.update(movement.__dict__)
movement.__dict__ = d movement.__dict__ = d
modified_movement_list.append(movement)
for movement in modified_movement_list:
# for each touched non buildable movement reset causality_list
if not movement.isBuildable(movement.getCausalityValue(
portal_type='Business Link')):
movement.setCausalityList([])
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