From 6fa61518d638123306208885344e91e2444f310d Mon Sep 17 00:00:00 2001
From: Kazuhiko Shiozaki <kazuhiko@nexedi.com>
Date: Tue, 16 Feb 2010 02:58:44 +0000
Subject: [PATCH] simplify the code.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@32571 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5/Document/CausalityAssignmentMovementGroup.py | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/product/ERP5/Document/CausalityAssignmentMovementGroup.py b/product/ERP5/Document/CausalityAssignmentMovementGroup.py
index ffd7db0e52..4f0954b734 100644
--- a/product/ERP5/Document/CausalityAssignmentMovementGroup.py
+++ b/product/ERP5/Document/CausalityAssignmentMovementGroup.py
@@ -56,13 +56,11 @@ class CausalityAssignmentMovementGroup(MovementGroup):
   def _addCausalityToEdit(self, movement, property_dict=None):
     if property_dict is None:
       property_dict = {}
-    parent = movement
-    # Go upper into the simulation tree in order to find an order link
-    while not parent.isRootAppliedRule():
-      parent = parent.getParentValue()
     causality_list = property_dict.get('causality_list', [])
+    root_movement = movement.getRootSimulationMovement()
     # 'order' category is deprecated. it is kept for compatibility.
-    movement_list = parent.getOrderList() or parent.getDeliveryList()
+    movement_list = root_movement.getOrderList() or \
+                    root_movement.getDeliveryList()
     for delivery_movement in movement_list:
       if delivery_movement not in causality_list:
         causality_list.append(delivery_movement)
-- 
2.30.9