diff --git a/product/ERP5/Document/SimulationMovement.py b/product/ERP5/Document/SimulationMovement.py index cadd8f621374e6fb6895f1468a8a312d9059ef2c..6c87834f7c98d6890b9296a8cad63c648e923b05 100644 --- a/product/ERP5/Document/SimulationMovement.py +++ b/product/ERP5/Document/SimulationMovement.py @@ -690,11 +690,14 @@ class SimulationMovement(Movement, PropertyRecordableMixin): for id, t in tree_node.visited_movement_dict.iteritems(): subdocument, path = t - to_check = path_set_to_check.copy() - to_check.discard(path) - if not to_check: - # no more paths to check in this branch - continue + to_check = path_set_to_check + # do we need to change/copy the set? + if path in to_check: + if len(to_check) == 1: + # no more paths to check in this branch + continue + to_check = to_check.copy() + to_check.remove(path) subtree = tree_node.get(id, treeNode()) for d in descendantGenerator(subdocument, subtree, to_check): yield d