diff --git a/product/ERP5Legacy/Document/Rule.py b/product/ERP5Legacy/Document/Rule.py index 3722ba08bd2e143ca9fd9981c859e09b8c3f54e6..cd52e64fd81b54bd05d375c0e6a62a47c66bd16a 100644 --- a/product/ERP5Legacy/Document/Rule.py +++ b/product/ERP5Legacy/Document/Rule.py @@ -330,11 +330,19 @@ class Rule(Predicate, XMLObject): mutable_movement_list = [] deletable_movement_list = [] + is_root = applied_rule.isRootAppliedRule() for movement in applied_rule.contentValues(portal_type=self.movement_type): + # XXX in root applied rule case, movement.isFrozen() is not a good + # criteria to determine if movement is immutable or not. Same for + # non-root case? if movement.isFrozen(): immutable_movement_list.append(movement) else: - if movement._isTreeDelivered(): + if is_root and movement.hasOrder(): + ignore_first = False + else: + ignore_first = True + if movement._isTreeDelivered(ignore_first=ignore_first): mutable_movement_list.append(movement) else: deletable_movement_list.append(movement)