From fd796eb99ee89f13ab0eb23891751969f799e3e2 Mon Sep 17 00:00:00 2001
From: Kazuhiko Shiozaki <kazuhiko@nexedi.com>
Date: Tue, 16 Feb 2010 05:01:56 +0000
Subject: [PATCH] to support both new and legacy simulation tree.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@32572 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../SimulationMovement_testTaxRule.xml                    | 8 +++++++-
 bt5/erp5_legacy_tax_system/bt/revision                    | 2 +-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/bt5/erp5_legacy_tax_system/SkinTemplateItem/portal_skins/erp5_legacy_tax_system/SimulationMovement_testTaxRule.xml b/bt5/erp5_legacy_tax_system/SkinTemplateItem/portal_skins/erp5_legacy_tax_system/SimulationMovement_testTaxRule.xml
index 37abd244da..ec3a686202 100644
--- a/bt5/erp5_legacy_tax_system/SkinTemplateItem/portal_skins/erp5_legacy_tax_system/SimulationMovement_testTaxRule.xml
+++ b/bt5/erp5_legacy_tax_system/SkinTemplateItem/portal_skins/erp5_legacy_tax_system/SimulationMovement_testTaxRule.xml
@@ -58,7 +58,12 @@
 parent = movement.getParentValue()\n
 if parent.getPortalType() == \'Applied Rule\':\n
   parent_rule = parent.getSpecialiseValue()\n
-  if parent_rule.getPortalType() not in [\'Delivery Rule\', \'Order Rule\']:\n
+  parent_rule_portal_type = parent_rule.getPortalType()\n
+  if parent_rule_portal_type not in [\'Order Rule\', \'Delivery Rule\', \'Delivering Simulation Rule\']:\n
+    return False\n
+  # XXX can we create tax rule for Production Order?\n
+  if parent_rule_portal_type in [\'Delivering Simulation Rule\',] and \\\n
+      parent.getParentValue().getParentValue().getSpecialiseValue().getPortalType() not in [\'Order Simulation Rule\']:\n
     return False\n
 \n
 return True\n
@@ -104,6 +109,7 @@ return True\n
                             <string>_getattr_</string>
                             <string>parent</string>
                             <string>parent_rule</string>
+                            <string>parent_rule_portal_type</string>
                             <string>False</string>
                             <string>True</string>
                           </tuple>
diff --git a/bt5/erp5_legacy_tax_system/bt/revision b/bt5/erp5_legacy_tax_system/bt/revision
index 301160a930..f11c82a4cb 100644
--- a/bt5/erp5_legacy_tax_system/bt/revision
+++ b/bt5/erp5_legacy_tax_system/bt/revision
@@ -1 +1 @@
-8
\ No newline at end of file
+9
\ No newline at end of file
-- 
2.30.9