From 4b863030a8b5c3bd391d8f251d0196b548e4198d Mon Sep 17 00:00:00 2001
From: Kazuhiko Shiozaki <kazuhiko@nexedi.com>
Date: Fri, 5 Mar 2010 16:47:27 +0000
Subject: [PATCH] simulation hierarchy is different if it begins with delivery.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@33470 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5/tests/testBPMEvaluation.py | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/product/ERP5/tests/testBPMEvaluation.py b/product/ERP5/tests/testBPMEvaluation.py
index 0e1db5a562..5c79f9a0a1 100644
--- a/product/ERP5/tests/testBPMEvaluation.py
+++ b/product/ERP5/tests/testBPMEvaluation.py
@@ -391,10 +391,13 @@ class TestBPMEvaluationMixin(TestBPMMixin):
       # root rule is order or delivery - so below each movement invoicing one
       # is expected
       self.assertEquals(len(root_simulation_movement.contentValues()), 1)
-      delivery_rule = root_simulation_movement.contentValues()[0]
-      delivery_simulation_movement_list = delivery_rule.contentValues()
-      self.assertEqual(1, len(delivery_simulation_movement_list))
-      delivery_simulation_movement = delivery_simulation_movement_list[0]
+      if self.root_rule_portal_type == 'Order Root Simulation Rule':
+        delivery_rule = root_simulation_movement.contentValues()[0]
+        delivery_simulation_movement_list = delivery_rule.contentValues()
+        self.assertEqual(1, len(delivery_simulation_movement_list))
+        delivery_simulation_movement = delivery_simulation_movement_list[0]
+      else:
+        delivery_simulation_movement = root_simulation_movement
       for bpm_invoicing_rule in delivery_simulation_movement.contentValues():
         self.assertEqual(bpm_invoicing_rule.getPortalType(), 'Applied Rule')
         self.assertEqual(bpm_invoicing_rule.getSpecialiseValue() \
-- 
2.30.9