From 7e1db468a810d85c8c4b32d4a894c8dc79d79988 Mon Sep 17 00:00:00 2001
From: Kazuhiko Shiozaki <kazuhiko@nexedi.com>
Date: Mon, 15 Feb 2010 04:51:04 +0000
Subject: [PATCH] * new rules that no longer use 'order' category. * modify
 builder's select methods to support both new and old simulation hierarchy.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@32519 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../Delivering%20Simulation%20Rule/view.xml   |  85 +++++++++
 .../Order%20Simulation%20Rule/view.xml        |  85 +++++++++
 .../default_delivering_simulation_rule.xml    | 161 ++++++++++++++++++
 .../default_category_tester.xml               | 109 ++++++++++++
 .../default_property_tester.xml               | 116 +++++++++++++
 .../default_quantity_tester.xml               |  94 ++++++++++
 .../default_order_simulation_rule.xml         | 159 +++++++++++++++++
 .../default_category_tester.xml               | 106 ++++++++++++
 .../default_property_tester.xml               | 115 +++++++++++++
 .../default_quantity_tester.xml               | 106 ++++++++++++
 .../allowed_content_types.xml                 |  10 ++
 .../Delivering%20Simulation%20Rule.xml        |  63 +++++++
 .../Order%20Simulation%20Rule.xml             |  63 +++++++
 .../workflow_chain_type.xml                   |   8 +
 .../PurchaseOrder_selectMovement.xml          |  18 +-
 .../erp5_trade/SaleOrder_selectMovement.xml   |  18 +-
 ...nMovement_testDeliveringSimulationRule.xml | 145 ++++++++++++++++
 bt5/erp5_trade/bt/template_action_path_list   |   2 +
 ...late_portal_type_allowed_content_type_list |   6 +
 .../bt/template_portal_type_id_list           |   2 +
 .../template_portal_type_workflow_chain_list  |   4 +
 21 files changed, 1467 insertions(+), 8 deletions(-)
 create mode 100644 bt5/erp5_trade/ActionTemplateItem/portal_types/Delivering%20Simulation%20Rule/view.xml
 create mode 100644 bt5/erp5_trade/ActionTemplateItem/portal_types/Order%20Simulation%20Rule/view.xml
 create mode 100644 bt5/erp5_trade/PathTemplateItem/portal_rules/default_delivering_simulation_rule.xml
 create mode 100644 bt5/erp5_trade/PathTemplateItem/portal_rules/default_delivering_simulation_rule/default_category_tester.xml
 create mode 100644 bt5/erp5_trade/PathTemplateItem/portal_rules/default_delivering_simulation_rule/default_property_tester.xml
 create mode 100644 bt5/erp5_trade/PathTemplateItem/portal_rules/default_delivering_simulation_rule/default_quantity_tester.xml
 create mode 100644 bt5/erp5_trade/PathTemplateItem/portal_rules/default_order_simulation_rule.xml
 create mode 100644 bt5/erp5_trade/PathTemplateItem/portal_rules/default_order_simulation_rule/default_category_tester.xml
 create mode 100644 bt5/erp5_trade/PathTemplateItem/portal_rules/default_order_simulation_rule/default_property_tester.xml
 create mode 100644 bt5/erp5_trade/PathTemplateItem/portal_rules/default_order_simulation_rule/default_quantity_tester.xml
 create mode 100644 bt5/erp5_trade/PortalTypeTemplateItem/portal_types/Delivering%20Simulation%20Rule.xml
 create mode 100644 bt5/erp5_trade/PortalTypeTemplateItem/portal_types/Order%20Simulation%20Rule.xml
 create mode 100644 bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/SimulationMovement_testDeliveringSimulationRule.xml

diff --git a/bt5/erp5_trade/ActionTemplateItem/portal_types/Delivering%20Simulation%20Rule/view.xml b/bt5/erp5_trade/ActionTemplateItem/portal_types/Delivering%20Simulation%20Rule/view.xml
new file mode 100644
index 0000000000..2b7a0e0ab4
--- /dev/null
+++ b/bt5/erp5_trade/ActionTemplateItem/portal_types/Delivering%20Simulation%20Rule/view.xml
@@ -0,0 +1,85 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <tuple>
+        <global name="ActionInformation" module="Products.CMFCore.ActionInformation"/>
+        <tuple/>
+      </tuple>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>action</string> </key>
+            <value>
+              <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
+            </value>
+        </item>
+        <item>
+            <key> <string>categories</string> </key>
+            <value>
+              <tuple>
+                <string>action_type/object_view</string>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key> <string>category</string> </key>
+            <value> <string>object_view</string> </value>
+        </item>
+        <item>
+            <key> <string>condition</string> </key>
+            <value> <string></string> </value>
+        </item>
+        <item>
+            <key> <string>description</string> </key>
+            <value> <string></string> </value>
+        </item>
+        <item>
+            <key> <string>icon</string> </key>
+            <value> <string></string> </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>view</string> </value>
+        </item>
+        <item>
+            <key> <string>permissions</string> </key>
+            <value>
+              <tuple>
+                <string>View</string>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key> <string>priority</string> </key>
+            <value> <float>1.0</float> </value>
+        </item>
+        <item>
+            <key> <string>title</string> </key>
+            <value> <string>View</string> </value>
+        </item>
+        <item>
+            <key> <string>visible</string> </key>
+            <value> <int>1</int> </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+  <record id="2" aka="AAAAAAAAAAI=">
+    <pickle>
+      <tuple>
+        <global name="Expression" module="Products.CMFCore.Expression"/>
+        <tuple/>
+      </tuple>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>text</string> </key>
+            <value> <string>string:${object_url}/Rule_view</string> </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>
diff --git a/bt5/erp5_trade/ActionTemplateItem/portal_types/Order%20Simulation%20Rule/view.xml b/bt5/erp5_trade/ActionTemplateItem/portal_types/Order%20Simulation%20Rule/view.xml
new file mode 100644
index 0000000000..2b7a0e0ab4
--- /dev/null
+++ b/bt5/erp5_trade/ActionTemplateItem/portal_types/Order%20Simulation%20Rule/view.xml
@@ -0,0 +1,85 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <tuple>
+        <global name="ActionInformation" module="Products.CMFCore.ActionInformation"/>
+        <tuple/>
+      </tuple>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>action</string> </key>
+            <value>
+              <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
+            </value>
+        </item>
+        <item>
+            <key> <string>categories</string> </key>
+            <value>
+              <tuple>
+                <string>action_type/object_view</string>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key> <string>category</string> </key>
+            <value> <string>object_view</string> </value>
+        </item>
+        <item>
+            <key> <string>condition</string> </key>
+            <value> <string></string> </value>
+        </item>
+        <item>
+            <key> <string>description</string> </key>
+            <value> <string></string> </value>
+        </item>
+        <item>
+            <key> <string>icon</string> </key>
+            <value> <string></string> </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>view</string> </value>
+        </item>
+        <item>
+            <key> <string>permissions</string> </key>
+            <value>
+              <tuple>
+                <string>View</string>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key> <string>priority</string> </key>
+            <value> <float>1.0</float> </value>
+        </item>
+        <item>
+            <key> <string>title</string> </key>
+            <value> <string>View</string> </value>
+        </item>
+        <item>
+            <key> <string>visible</string> </key>
+            <value> <int>1</int> </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+  <record id="2" aka="AAAAAAAAAAI=">
+    <pickle>
+      <tuple>
+        <global name="Expression" module="Products.CMFCore.Expression"/>
+        <tuple/>
+      </tuple>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>text</string> </key>
+            <value> <string>string:${object_url}/Rule_view</string> </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>
diff --git a/bt5/erp5_trade/PathTemplateItem/portal_rules/default_delivering_simulation_rule.xml b/bt5/erp5_trade/PathTemplateItem/portal_rules/default_delivering_simulation_rule.xml
new file mode 100644
index 0000000000..3fd8382d1f
--- /dev/null
+++ b/bt5/erp5_trade/PathTemplateItem/portal_rules/default_delivering_simulation_rule.xml
@@ -0,0 +1,161 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <tuple>
+        <global name="DeliveringSimulationRule" module="Products.ERP5Type.Document.DeliveringSimulationRule"/>
+        <tuple/>
+      </tuple>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>_count</string> </key>
+            <value>
+              <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
+            </value>
+        </item>
+        <item>
+            <key> <string>_identity_criterion</string> </key>
+            <value>
+              <dictionary/>
+            </value>
+        </item>
+        <item>
+            <key> <string>_mt_index</string> </key>
+            <value>
+              <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
+            </value>
+        </item>
+        <item>
+            <key> <string>_range_criterion</string> </key>
+            <value>
+              <dictionary>
+                <item>
+                    <key> <string>start_date</string> </key>
+                    <value>
+                      <tuple>
+                        <none/>
+                        <none/>
+                      </tuple>
+                    </value>
+                </item>
+              </dictionary>
+            </value>
+        </item>
+        <item>
+            <key> <string>_tree</string> </key>
+            <value>
+              <persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
+            </value>
+        </item>
+        <item>
+            <key> <string>categories</string> </key>
+            <value>
+              <tuple/>
+            </value>
+        </item>
+        <item>
+            <key> <string>default_reference</string> </key>
+            <value> <string>default_delivering_rule</string> </value>
+        </item>
+        <item>
+            <key> <string>description</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>expandable_property</string> </key>
+            <value>
+              <tuple>
+                <string>source</string>
+                <string>source_section</string>
+                <string>source_decision</string>
+                <string>source_administration</string>
+                <string>source_project</string>
+                <string>source_function</string>
+                <string>source_payment</string>
+                <string>source_account</string>
+                <string>destination</string>
+                <string>destination_section</string>
+                <string>destination_decision</string>
+                <string>destination_administration</string>
+                <string>destination_project</string>
+                <string>destination_function</string>
+                <string>destination_payment</string>
+                <string>destination_account</string>
+                <string>start_date</string>
+                <string>stop_date</string>
+                <string>description</string>
+                <string>resource</string>
+                <string>variation_category_list</string>
+                <string>variation_property_dict</string>
+                <string>delivery_mode</string>
+                <string>incoterm</string>
+                <string>base_contribution_list</string>
+                <string>aggregate_list</string>
+                <string>quantity</string>
+                <string>quantity_unit</string>
+                <string>price</string>
+                <string>price_currency</string>
+                <string>efficiency</string>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>default_delivering_simulation_rule</string> </value>
+        </item>
+        <item>
+            <key> <string>matching_property</string> </key>
+            <value>
+              <tuple/>
+            </value>
+        </item>
+        <item>
+            <key> <string>portal_type</string> </key>
+            <value> <string>Delivering Simulation Rule</string> </value>
+        </item>
+        <item>
+            <key> <string>test_method_id</string> </key>
+            <value>
+              <tuple>
+                <string>SimulationMovement_testDeliveringSimulationRule</string>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key> <string>title</string> </key>
+            <value> <string>Default Delivering Simulation Rule</string> </value>
+        </item>
+        <item>
+            <key> <string>version</string> </key>
+            <value> <string>1</string> </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+  <record id="2" aka="AAAAAAAAAAI=">
+    <pickle>
+      <global name="Length" module="BTrees.Length"/>
+    </pickle>
+    <pickle> <int>0</int> </pickle>
+  </record>
+  <record id="3" aka="AAAAAAAAAAM=">
+    <pickle>
+      <global name="OOBTree" module="BTrees._OOBTree"/>
+    </pickle>
+    <pickle>
+      <none/>
+    </pickle>
+  </record>
+  <record id="4" aka="AAAAAAAAAAQ=">
+    <pickle>
+      <global name="OOBTree" module="BTrees._OOBTree"/>
+    </pickle>
+    <pickle>
+      <none/>
+    </pickle>
+  </record>
+</ZopeData>
diff --git a/bt5/erp5_trade/PathTemplateItem/portal_rules/default_delivering_simulation_rule/default_category_tester.xml b/bt5/erp5_trade/PathTemplateItem/portal_rules/default_delivering_simulation_rule/default_category_tester.xml
new file mode 100644
index 0000000000..2f8e133c40
--- /dev/null
+++ b/bt5/erp5_trade/PathTemplateItem/portal_rules/default_delivering_simulation_rule/default_category_tester.xml
@@ -0,0 +1,109 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <tuple>
+        <global name="CategoryDivergenceTester" module="Products.ERP5Type.Document.CategoryDivergenceTester"/>
+        <tuple/>
+      </tuple>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>_count</string> </key>
+            <value>
+              <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
+            </value>
+        </item>
+        <item>
+            <key> <string>_mt_index</string> </key>
+            <value>
+              <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
+            </value>
+        </item>
+        <item>
+            <key> <string>_tree</string> </key>
+            <value>
+              <persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
+            </value>
+        </item>
+        <item>
+            <key> <string>description</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>default_category_tester</string> </value>
+        </item>
+        <item>
+            <key> <string>portal_type</string> </key>
+            <value> <string>Category Divergence Tester</string> </value>
+        </item>
+        <item>
+            <key> <string>solver</string> </key>
+            <value>
+              <tuple>
+                <string>CopyToTarget</string>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key> <string>tested_property</string> </key>
+            <value>
+              <tuple>
+                <string>aggregate | Aggregate</string>
+                <string>base_application | Base Application</string>
+                <string>base_contribution | Base Contribution</string>
+                <string>destination | Destination</string>
+                <string>destination_account | Destination Account</string>
+                <string>destination_administration | Destination Administration</string>
+                <string>destination_decision | Destination Decision</string>
+                <string>destination_function | Destination Function</string>
+                <string>destination_payment | Destination Payment</string>
+                <string>destination_project | Destination Project</string>
+                <string>destination_section | Destination Section</string>
+                <string>price_currency | Price Currency</string>
+                <string>resource | Resource</string>
+                <string>source | Source</string>
+                <string>source_account | Source Account</string>
+                <string>source_administration | Source Administration</string>
+                <string>source_decision | Source Decision</string>
+                <string>source_function | Source Function</string>
+                <string>source_payment | Source Payment</string>
+                <string>source_project | Source Project</string>
+                <string>source_section | Source Section</string>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key> <string>title</string> </key>
+            <value> <string></string> </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+  <record id="2" aka="AAAAAAAAAAI=">
+    <pickle>
+      <global name="Length" module="BTrees.Length"/>
+    </pickle>
+    <pickle> <int>0</int> </pickle>
+  </record>
+  <record id="3" aka="AAAAAAAAAAM=">
+    <pickle>
+      <global name="OOBTree" module="BTrees._OOBTree"/>
+    </pickle>
+    <pickle>
+      <none/>
+    </pickle>
+  </record>
+  <record id="4" aka="AAAAAAAAAAQ=">
+    <pickle>
+      <global name="OOBTree" module="BTrees._OOBTree"/>
+    </pickle>
+    <pickle>
+      <none/>
+    </pickle>
+  </record>
+</ZopeData>
diff --git a/bt5/erp5_trade/PathTemplateItem/portal_rules/default_delivering_simulation_rule/default_property_tester.xml b/bt5/erp5_trade/PathTemplateItem/portal_rules/default_delivering_simulation_rule/default_property_tester.xml
new file mode 100644
index 0000000000..cfa35068bf
--- /dev/null
+++ b/bt5/erp5_trade/PathTemplateItem/portal_rules/default_delivering_simulation_rule/default_property_tester.xml
@@ -0,0 +1,116 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <tuple>
+        <global name="PropertyDivergenceTester" module="Products.ERP5Type.Document.PropertyDivergenceTester"/>
+        <tuple/>
+      </tuple>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>_count</string> </key>
+            <value>
+              <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
+            </value>
+        </item>
+        <item>
+            <key> <string>_local_properties</string> </key>
+            <value>
+              <tuple>
+                <dictionary>
+                  <item>
+                      <key> <string>id</string> </key>
+                      <value> <string>tested_property_list</string> </value>
+                  </item>
+                  <item>
+                      <key> <string>type</string> </key>
+                      <value> <string>string</string> </value>
+                  </item>
+                </dictionary>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key> <string>_mt_index</string> </key>
+            <value>
+              <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
+            </value>
+        </item>
+        <item>
+            <key> <string>_tree</string> </key>
+            <value>
+              <persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
+            </value>
+        </item>
+        <item>
+            <key> <string>description</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>default_property_tester</string> </value>
+        </item>
+        <item>
+            <key> <string>portal_type</string> </key>
+            <value> <string>Property Divergence Tester</string> </value>
+        </item>
+        <item>
+            <key> <string>solver</string> </key>
+            <value>
+              <tuple>
+                <string>CopyToTarget</string>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key> <string>tested_property</string> </key>
+            <value>
+              <tuple>
+                <string>start_date | Start Date</string>
+                <string>stop_date | Stop Date</string>
+                <string>price | Price</string>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key> <string>tested_property_list</string> </key>
+            <value>
+              <tuple>
+                <string>aaa</string>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key> <string>title</string> </key>
+            <value> <string></string> </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+  <record id="2" aka="AAAAAAAAAAI=">
+    <pickle>
+      <global name="Length" module="BTrees.Length"/>
+    </pickle>
+    <pickle> <int>0</int> </pickle>
+  </record>
+  <record id="3" aka="AAAAAAAAAAM=">
+    <pickle>
+      <global name="OOBTree" module="BTrees._OOBTree"/>
+    </pickle>
+    <pickle>
+      <none/>
+    </pickle>
+  </record>
+  <record id="4" aka="AAAAAAAAAAQ=">
+    <pickle>
+      <global name="OOBTree" module="BTrees._OOBTree"/>
+    </pickle>
+    <pickle>
+      <none/>
+    </pickle>
+  </record>
+</ZopeData>
diff --git a/bt5/erp5_trade/PathTemplateItem/portal_rules/default_delivering_simulation_rule/default_quantity_tester.xml b/bt5/erp5_trade/PathTemplateItem/portal_rules/default_delivering_simulation_rule/default_quantity_tester.xml
new file mode 100644
index 0000000000..fc509725a8
--- /dev/null
+++ b/bt5/erp5_trade/PathTemplateItem/portal_rules/default_delivering_simulation_rule/default_quantity_tester.xml
@@ -0,0 +1,94 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <tuple>
+        <global name="QuantityDivergenceTester" module="Products.ERP5Type.Document.QuantityDivergenceTester"/>
+        <tuple/>
+      </tuple>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>_count</string> </key>
+            <value>
+              <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
+            </value>
+        </item>
+        <item>
+            <key> <string>_mt_index</string> </key>
+            <value>
+              <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
+            </value>
+        </item>
+        <item>
+            <key> <string>_tree</string> </key>
+            <value>
+              <persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
+            </value>
+        </item>
+        <item>
+            <key> <string>description</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>default_quantity_tester</string> </value>
+        </item>
+        <item>
+            <key> <string>portal_type</string> </key>
+            <value> <string>Quantity Divergence Tester</string> </value>
+        </item>
+        <item>
+            <key> <string>property_tester</string> </key>
+            <value> <string>quantity</string> </value>
+        </item>
+        <item>
+            <key> <string>solver</string> </key>
+            <value>
+              <tuple>
+                <string>SplitAndDefer</string>
+                <string>CopyToTarget</string>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key> <string>solver_list</string> </key>
+            <value>
+              <tuple>
+                <string>Solver</string>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key> <string>title</string> </key>
+            <value> <string></string> </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+  <record id="2" aka="AAAAAAAAAAI=">
+    <pickle>
+      <global name="Length" module="BTrees.Length"/>
+    </pickle>
+    <pickle> <int>0</int> </pickle>
+  </record>
+  <record id="3" aka="AAAAAAAAAAM=">
+    <pickle>
+      <global name="OOBTree" module="BTrees._OOBTree"/>
+    </pickle>
+    <pickle>
+      <none/>
+    </pickle>
+  </record>
+  <record id="4" aka="AAAAAAAAAAQ=">
+    <pickle>
+      <global name="OOBTree" module="BTrees._OOBTree"/>
+    </pickle>
+    <pickle>
+      <none/>
+    </pickle>
+  </record>
+</ZopeData>
diff --git a/bt5/erp5_trade/PathTemplateItem/portal_rules/default_order_simulation_rule.xml b/bt5/erp5_trade/PathTemplateItem/portal_rules/default_order_simulation_rule.xml
new file mode 100644
index 0000000000..8fe6464a0c
--- /dev/null
+++ b/bt5/erp5_trade/PathTemplateItem/portal_rules/default_order_simulation_rule.xml
@@ -0,0 +1,159 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <tuple>
+        <global name="OrderSimulationRule" module="Products.ERP5Type.Document.OrderSimulationRule"/>
+        <tuple/>
+      </tuple>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>_count</string> </key>
+            <value>
+              <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
+            </value>
+        </item>
+        <item>
+            <key> <string>_identity_criterion</string> </key>
+            <value>
+              <dictionary/>
+            </value>
+        </item>
+        <item>
+            <key> <string>_mt_index</string> </key>
+            <value>
+              <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
+            </value>
+        </item>
+        <item>
+            <key> <string>_range_criterion</string> </key>
+            <value>
+              <dictionary>
+                <item>
+                    <key> <string>start_date</string> </key>
+                    <value>
+                      <tuple>
+                        <none/>
+                        <none/>
+                      </tuple>
+                    </value>
+                </item>
+              </dictionary>
+            </value>
+        </item>
+        <item>
+            <key> <string>_tree</string> </key>
+            <value>
+              <persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
+            </value>
+        </item>
+        <item>
+            <key> <string>categories</string> </key>
+            <value>
+              <tuple/>
+            </value>
+        </item>
+        <item>
+            <key> <string>default_reference</string> </key>
+            <value> <string>default_order_rule</string> </value>
+        </item>
+        <item>
+            <key> <string>description</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>expandable_property</string> </key>
+            <value>
+              <tuple>
+                <string>aggregate_list</string>
+                <string>base_contribution_list</string>
+                <string>description</string>
+                <string>destination</string>
+                <string>destination_account</string>
+                <string>destination_administration</string>
+                <string>destination_decision</string>
+                <string>destination_function</string>
+                <string>destination_payment</string>
+                <string>destination_project</string>
+                <string>destination_section</string>
+                <string>incoterm</string>
+                <string>price</string>
+                <string>price_currency</string>
+                <string>quantity</string>
+                <string>quantity_unit</string>
+                <string>resource</string>
+                <string>source</string>
+                <string>source_account</string>
+                <string>source_administration</string>
+                <string>source_decision</string>
+                <string>source_function</string>
+                <string>source_payment</string>
+                <string>source_project</string>
+                <string>source_section</string>
+                <string>start_date</string>
+                <string>stop_date</string>
+                <string>variation_category_list</string>
+                <string>variation_property_dict</string>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>default_order_simulation_rule</string> </value>
+        </item>
+        <item>
+            <key> <string>matching_property</string> </key>
+            <value>
+              <tuple>
+                <string>delivery</string>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key> <string>portal_type</string> </key>
+            <value> <string>Order Simulation Rule</string> </value>
+        </item>
+        <item>
+            <key> <string>test_method_id</string> </key>
+            <value>
+              <tuple/>
+            </value>
+        </item>
+        <item>
+            <key> <string>title</string> </key>
+            <value> <string>Default Order Simulation Rule</string> </value>
+        </item>
+        <item>
+            <key> <string>version</string> </key>
+            <value> <string>2</string> </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+  <record id="2" aka="AAAAAAAAAAI=">
+    <pickle>
+      <global name="Length" module="BTrees.Length"/>
+    </pickle>
+    <pickle> <int>0</int> </pickle>
+  </record>
+  <record id="3" aka="AAAAAAAAAAM=">
+    <pickle>
+      <global name="OOBTree" module="BTrees._OOBTree"/>
+    </pickle>
+    <pickle>
+      <none/>
+    </pickle>
+  </record>
+  <record id="4" aka="AAAAAAAAAAQ=">
+    <pickle>
+      <global name="OOBTree" module="BTrees._OOBTree"/>
+    </pickle>
+    <pickle>
+      <none/>
+    </pickle>
+  </record>
+</ZopeData>
diff --git a/bt5/erp5_trade/PathTemplateItem/portal_rules/default_order_simulation_rule/default_category_tester.xml b/bt5/erp5_trade/PathTemplateItem/portal_rules/default_order_simulation_rule/default_category_tester.xml
new file mode 100644
index 0000000000..b28b001799
--- /dev/null
+++ b/bt5/erp5_trade/PathTemplateItem/portal_rules/default_order_simulation_rule/default_category_tester.xml
@@ -0,0 +1,106 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <tuple>
+        <global name="CategoryDivergenceTester" module="Products.ERP5Type.Document.CategoryDivergenceTester"/>
+        <tuple/>
+      </tuple>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>_count</string> </key>
+            <value>
+              <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
+            </value>
+        </item>
+        <item>
+            <key> <string>_mt_index</string> </key>
+            <value>
+              <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
+            </value>
+        </item>
+        <item>
+            <key> <string>_tree</string> </key>
+            <value>
+              <persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
+            </value>
+        </item>
+        <item>
+            <key> <string>description</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>default_category_tester</string> </value>
+        </item>
+        <item>
+            <key> <string>portal_type</string> </key>
+            <value> <string>Category Divergence Tester</string> </value>
+        </item>
+        <item>
+            <key> <string>solver</string> </key>
+            <value>
+              <tuple>
+                <string>CopyToTarget</string>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key> <string>tested_property</string> </key>
+            <value>
+              <tuple>
+                <string>aggregate | Aggregate</string>
+                <string>destination | Destination</string>
+                <string>destination_account | Destination Account</string>
+                <string>destination_administration | Destination Administration</string>
+                <string>destination_decision | Destination Decision</string>
+                <string>destination_function | Destination Function</string>
+                <string>destination_payment | Destination Payment</string>
+                <string>destination_project | Destination Project</string>
+                <string>destination_section | Destination Section</string>
+                <string>resource | Resource</string>
+                <string>source | Source</string>
+                <string>source_account | Source Account</string>
+                <string>source_administration | Source Administration</string>
+                <string>source_decision | Source Decision</string>
+                <string>source_function | Source Function</string>
+                <string>source_payment | Source Payment</string>
+                <string>source_project | Source Project</string>
+                <string>source_section | Source Section</string>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key> <string>title</string> </key>
+            <value> <string></string> </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+  <record id="2" aka="AAAAAAAAAAI=">
+    <pickle>
+      <global name="Length" module="BTrees.Length"/>
+    </pickle>
+    <pickle> <int>0</int> </pickle>
+  </record>
+  <record id="3" aka="AAAAAAAAAAM=">
+    <pickle>
+      <global name="OOBTree" module="BTrees._OOBTree"/>
+    </pickle>
+    <pickle>
+      <none/>
+    </pickle>
+  </record>
+  <record id="4" aka="AAAAAAAAAAQ=">
+    <pickle>
+      <global name="OOBTree" module="BTrees._OOBTree"/>
+    </pickle>
+    <pickle>
+      <none/>
+    </pickle>
+  </record>
+</ZopeData>
diff --git a/bt5/erp5_trade/PathTemplateItem/portal_rules/default_order_simulation_rule/default_property_tester.xml b/bt5/erp5_trade/PathTemplateItem/portal_rules/default_order_simulation_rule/default_property_tester.xml
new file mode 100644
index 0000000000..4b132baeb2
--- /dev/null
+++ b/bt5/erp5_trade/PathTemplateItem/portal_rules/default_order_simulation_rule/default_property_tester.xml
@@ -0,0 +1,115 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <tuple>
+        <global name="PropertyDivergenceTester" module="Products.ERP5Type.Document.PropertyDivergenceTester"/>
+        <tuple/>
+      </tuple>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>_count</string> </key>
+            <value>
+              <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
+            </value>
+        </item>
+        <item>
+            <key> <string>_local_properties</string> </key>
+            <value>
+              <tuple>
+                <dictionary>
+                  <item>
+                      <key> <string>id</string> </key>
+                      <value> <string>tested_property_list</string> </value>
+                  </item>
+                  <item>
+                      <key> <string>type</string> </key>
+                      <value> <string>string</string> </value>
+                  </item>
+                </dictionary>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key> <string>_mt_index</string> </key>
+            <value>
+              <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
+            </value>
+        </item>
+        <item>
+            <key> <string>_tree</string> </key>
+            <value>
+              <persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
+            </value>
+        </item>
+        <item>
+            <key> <string>description</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>default_property_tester</string> </value>
+        </item>
+        <item>
+            <key> <string>portal_type</string> </key>
+            <value> <string>Property Divergence Tester</string> </value>
+        </item>
+        <item>
+            <key> <string>solver</string> </key>
+            <value>
+              <tuple>
+                <string>CopyToTarget</string>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key> <string>tested_property</string> </key>
+            <value>
+              <tuple>
+                <string>start_date | Start Date</string>
+                <string>stop_date | Stop Date</string>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key> <string>tested_property_list</string> </key>
+            <value>
+              <tuple>
+                <string>aaa</string>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key> <string>title</string> </key>
+            <value> <string></string> </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+  <record id="2" aka="AAAAAAAAAAI=">
+    <pickle>
+      <global name="Length" module="BTrees.Length"/>
+    </pickle>
+    <pickle> <int>0</int> </pickle>
+  </record>
+  <record id="3" aka="AAAAAAAAAAM=">
+    <pickle>
+      <global name="OOBTree" module="BTrees._OOBTree"/>
+    </pickle>
+    <pickle>
+      <none/>
+    </pickle>
+  </record>
+  <record id="4" aka="AAAAAAAAAAQ=">
+    <pickle>
+      <global name="OOBTree" module="BTrees._OOBTree"/>
+    </pickle>
+    <pickle>
+      <none/>
+    </pickle>
+  </record>
+</ZopeData>
diff --git a/bt5/erp5_trade/PathTemplateItem/portal_rules/default_order_simulation_rule/default_quantity_tester.xml b/bt5/erp5_trade/PathTemplateItem/portal_rules/default_order_simulation_rule/default_quantity_tester.xml
new file mode 100644
index 0000000000..35a323fb8c
--- /dev/null
+++ b/bt5/erp5_trade/PathTemplateItem/portal_rules/default_order_simulation_rule/default_quantity_tester.xml
@@ -0,0 +1,106 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <tuple>
+        <global name="QuantityDivergenceTester" module="Products.ERP5Type.Document.QuantityDivergenceTester"/>
+        <tuple/>
+      </tuple>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>_count</string> </key>
+            <value>
+              <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
+            </value>
+        </item>
+        <item>
+            <key> <string>_mt_index</string> </key>
+            <value>
+              <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
+            </value>
+        </item>
+        <item>
+            <key> <string>_tree</string> </key>
+            <value>
+              <persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
+            </value>
+        </item>
+        <item>
+            <key> <string>description</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>default_quantity_tester</string> </value>
+        </item>
+        <item>
+            <key> <string>portal_type</string> </key>
+            <value> <string>Quantity Divergence Tester</string> </value>
+        </item>
+        <item>
+            <key> <string>property_tester</string> </key>
+            <value> <string>quantity</string> </value>
+        </item>
+        <item>
+            <key> <string>solver</string> </key>
+            <value>
+              <tuple>
+                <string>SplitAndDefer</string>
+                <string>CopyToTarget</string>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key> <string>solver_list</string> </key>
+            <value>
+              <tuple>
+                <string>Solver</string>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key> <string>solver_script</string> </key>
+            <value>
+              <tuple/>
+            </value>
+        </item>
+        <item>
+            <key> <string>tested_property</string> </key>
+            <value>
+              <tuple/>
+            </value>
+        </item>
+        <item>
+            <key> <string>title</string> </key>
+            <value> <string></string> </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+  <record id="2" aka="AAAAAAAAAAI=">
+    <pickle>
+      <global name="Length" module="BTrees.Length"/>
+    </pickle>
+    <pickle> <int>0</int> </pickle>
+  </record>
+  <record id="3" aka="AAAAAAAAAAM=">
+    <pickle>
+      <global name="OOBTree" module="BTrees._OOBTree"/>
+    </pickle>
+    <pickle>
+      <none/>
+    </pickle>
+  </record>
+  <record id="4" aka="AAAAAAAAAAQ=">
+    <pickle>
+      <global name="OOBTree" module="BTrees._OOBTree"/>
+    </pickle>
+    <pickle>
+      <none/>
+    </pickle>
+  </record>
+</ZopeData>
diff --git a/bt5/erp5_trade/PortalTypeAllowedContentTypeTemplateItem/allowed_content_types.xml b/bt5/erp5_trade/PortalTypeAllowedContentTypeTemplateItem/allowed_content_types.xml
index 99156a9197..2d2e6e6782 100644
--- a/bt5/erp5_trade/PortalTypeAllowedContentTypeTemplateItem/allowed_content_types.xml
+++ b/bt5/erp5_trade/PortalTypeAllowedContentTypeTemplateItem/allowed_content_types.xml
@@ -13,6 +13,11 @@
  <portal_type id="Container Line">
   <item>Container Cell</item>
  </portal_type>
+ <portal_type id="Delivering Simulation Rule">
+  <item>Category Divergence Tester</item>
+  <item>Property Divergence Tester</item>
+  <item>Quantity Divergence Tester</item>
+ </portal_type>
  <portal_type id="Delivery Builder">
   <item>First Causality Movement Group</item>
  </portal_type>
@@ -44,6 +49,11 @@
   <item>Property Divergence Tester</item>
   <item>Quantity Divergence Tester</item>
  </portal_type>
+ <portal_type id="Order Simulation Rule">
+  <item>Category Divergence Tester</item>
+  <item>Property Divergence Tester</item>
+  <item>Quantity Divergence Tester</item>
+ </portal_type>
  <portal_type id="Preference">
   <item>Sale Order</item>
  </portal_type>
diff --git a/bt5/erp5_trade/PortalTypeTemplateItem/portal_types/Delivering%20Simulation%20Rule.xml b/bt5/erp5_trade/PortalTypeTemplateItem/portal_types/Delivering%20Simulation%20Rule.xml
new file mode 100644
index 0000000000..e4af3d92c4
--- /dev/null
+++ b/bt5/erp5_trade/PortalTypeTemplateItem/portal_types/Delivering%20Simulation%20Rule.xml
@@ -0,0 +1,63 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <tuple>
+        <global name="ERP5TypeInformation" module="Products.ERP5Type.ERP5Type"/>
+        <tuple/>
+      </tuple>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>acquire_local_roles</string> </key>
+            <value> <int>1</int> </value>
+        </item>
+        <item>
+            <key> <string>content_icon</string> </key>
+            <value> <string>rule_icon.gif</string> </value>
+        </item>
+        <item>
+            <key> <string>content_meta_type</string> </key>
+            <value> <string>ERP5 Delivering Simulation Rule</string> </value>
+        </item>
+        <item>
+            <key> <string>description</string> </key>
+            <value> <string>An ERP5 Rule...</string> </value>
+        </item>
+        <item>
+            <key> <string>factory</string> </key>
+            <value> <string>addDeliveringSimulationRule</string> </value>
+        </item>
+        <item>
+            <key> <string>filter_content_types</string> </key>
+            <value> <int>1</int> </value>
+        </item>
+        <item>
+            <key> <string>group_list</string> </key>
+            <value>
+              <tuple>
+                <string>rule</string>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>Delivering Simulation Rule</string> </value>
+        </item>
+        <item>
+            <key> <string>init_script</string> </key>
+            <value> <string></string> </value>
+        </item>
+        <item>
+            <key> <string>permission</string> </key>
+            <value> <string></string> </value>
+        </item>
+        <item>
+            <key> <string>title</string> </key>
+            <value> <string></string> </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>
diff --git a/bt5/erp5_trade/PortalTypeTemplateItem/portal_types/Order%20Simulation%20Rule.xml b/bt5/erp5_trade/PortalTypeTemplateItem/portal_types/Order%20Simulation%20Rule.xml
new file mode 100644
index 0000000000..4f591d3fe3
--- /dev/null
+++ b/bt5/erp5_trade/PortalTypeTemplateItem/portal_types/Order%20Simulation%20Rule.xml
@@ -0,0 +1,63 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <tuple>
+        <global name="ERP5TypeInformation" module="Products.ERP5Type.ERP5Type"/>
+        <tuple/>
+      </tuple>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>acquire_local_roles</string> </key>
+            <value> <int>1</int> </value>
+        </item>
+        <item>
+            <key> <string>content_icon</string> </key>
+            <value> <string>rule_icon.gif</string> </value>
+        </item>
+        <item>
+            <key> <string>content_meta_type</string> </key>
+            <value> <string>ERP5 Order Simulation Rule</string> </value>
+        </item>
+        <item>
+            <key> <string>description</string> </key>
+            <value> <string>An ERP5 Rule...</string> </value>
+        </item>
+        <item>
+            <key> <string>factory</string> </key>
+            <value> <string>addOrderSimulationRule</string> </value>
+        </item>
+        <item>
+            <key> <string>filter_content_types</string> </key>
+            <value> <int>1</int> </value>
+        </item>
+        <item>
+            <key> <string>group_list</string> </key>
+            <value>
+              <tuple>
+                <string>rule</string>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>Order Simulation Rule</string> </value>
+        </item>
+        <item>
+            <key> <string>init_script</string> </key>
+            <value> <string></string> </value>
+        </item>
+        <item>
+            <key> <string>permission</string> </key>
+            <value> <string></string> </value>
+        </item>
+        <item>
+            <key> <string>title</string> </key>
+            <value> <string></string> </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>
diff --git a/bt5/erp5_trade/PortalTypeWorkflowChainTemplateItem/workflow_chain_type.xml b/bt5/erp5_trade/PortalTypeWorkflowChainTemplateItem/workflow_chain_type.xml
index d7f2da70e3..c48af3c176 100644
--- a/bt5/erp5_trade/PortalTypeWorkflowChainTemplateItem/workflow_chain_type.xml
+++ b/bt5/erp5_trade/PortalTypeWorkflowChainTemplateItem/workflow_chain_type.xml
@@ -23,6 +23,10 @@
   <type>Container Line</type>
   <workflow>container_interaction_workflow, edit_workflow, pricing_interaction_workflow, trade_matrix_workflow</workflow>
  </chain>
+ <chain>
+  <type>Delivering Simulation Rule</type>
+  <workflow>edit_workflow, rule_validation_workflow</workflow>
+ </chain>
  <chain>
   <type>Delivery Cell</type>
   <workflow>delivery_movement_causality_interaction_workflow, delivery_movement_simulation_interaction_workflow</workflow>
@@ -59,6 +63,10 @@
   <type>Order Rule</type>
   <workflow>edit_workflow, rule_validation_workflow</workflow>
  </chain>
+ <chain>
+  <type>Order Simulation Rule</type>
+  <workflow>edit_workflow, rule_validation_workflow</workflow>
+ </chain>
  <chain>
   <type>Payment Condition</type>
   <workflow>edit_workflow</workflow>
diff --git a/bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/PurchaseOrder_selectMovement.xml b/bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/PurchaseOrder_selectMovement.xml
index a8a2a94f1a..cf3913817d 100644
--- a/bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/PurchaseOrder_selectMovement.xml
+++ b/bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/PurchaseOrder_selectMovement.xml
@@ -53,10 +53,17 @@
         </item>
         <item>
             <key> <string>_body</string> </key>
-            <value> <string>kw[\'parent_specialise_portal_type\'] = [\'Order Rule\', \'Delivery Rule\']\n
-kw[\'explanation_portal_type\'] = \'Purchase Order\'\n
-kw[\'portal_type\']             = \'Simulation Movement\'\n
-kw[\'simulation_state\']        = \'confirmed\'\n
+            <value> <string>from Products.ZSQLCatalog.SQLCatalog import Query, ComplexQuery\n
+\n
+kw[\'query\'] = ComplexQuery(\n
+  Query(portal_type=\'Simulation Movement\', explanation_portal_type=\'Purchase Order\'),\n
+  ComplexQuery(\n
+    Query(parent_specialise_portal_type=[\'Order Rule\', \'Delivery Rule\'],\n
+          simulation_state=\'confirmed\'),\n
+    Query(parent_specialise_portal_type=\'Delivering Simulation Rule\',\n
+          grand_parent_simulation_state=\'confirmed\'),\n
+    operator=\'or\'),\n
+  operator=\'and\')\n
 \n
 kw.update(context.portal_catalog.buildSQLQuery(**kw))\n
 \n
@@ -111,6 +118,9 @@ else:\n
                           <tuple>
                             <string>src__</string>
                             <string>kw</string>
+                            <string>Products.ZSQLCatalog.SQLCatalog</string>
+                            <string>Query</string>
+                            <string>ComplexQuery</string>
                             <string>_write_</string>
                             <string>_getattr_</string>
                             <string>_apply_</string>
diff --git a/bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/SaleOrder_selectMovement.xml b/bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/SaleOrder_selectMovement.xml
index c28d20a173..4bda97161c 100644
--- a/bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/SaleOrder_selectMovement.xml
+++ b/bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/SaleOrder_selectMovement.xml
@@ -53,10 +53,17 @@
         </item>
         <item>
             <key> <string>_body</string> </key>
-            <value> <string>kw[\'parent_specialise_portal_type\'] = [\'Order Rule\', \'Delivery Rule\']\n
-kw[\'explanation_portal_type\'] = \'Sale Order\'\n
-kw[\'portal_type\']             = \'Simulation Movement\'\n
-kw[\'simulation_state\']        = \'confirmed\'\n
+            <value> <string>from Products.ZSQLCatalog.SQLCatalog import Query, ComplexQuery\n
+\n
+kw[\'query\'] = ComplexQuery(\n
+  Query(portal_type=\'Simulation Movement\', explanation_portal_type=\'Sale Order\'),\n
+  ComplexQuery(\n
+    Query(parent_specialise_portal_type=[\'Order Rule\', \'Delivery Rule\'],\n
+          simulation_state=\'confirmed\'),\n
+    Query(parent_specialise_portal_type=\'Delivering Simulation Rule\',\n
+          grand_parent_simulation_state=\'confirmed\'),\n
+    operator=\'or\'),\n
+  operator=\'and\')\n
 \n
 kw.update(context.portal_catalog.buildSQLQuery(**kw))\n
 #from Products.ERP5Type.Log import log\n
@@ -114,6 +121,9 @@ else:\n
                           <tuple>
                             <string>src__</string>
                             <string>kw</string>
+                            <string>Products.ZSQLCatalog.SQLCatalog</string>
+                            <string>Query</string>
+                            <string>ComplexQuery</string>
                             <string>_write_</string>
                             <string>_getattr_</string>
                             <string>_apply_</string>
diff --git a/bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/SimulationMovement_testDeliveringSimulationRule.xml b/bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/SimulationMovement_testDeliveringSimulationRule.xml
new file mode 100644
index 0000000000..640afebed1
--- /dev/null
+++ b/bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/SimulationMovement_testDeliveringSimulationRule.xml
@@ -0,0 +1,145 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <tuple>
+        <global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
+        <tuple/>
+      </tuple>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>Script_magic</string> </key>
+            <value> <int>3</int> </value>
+        </item>
+        <item>
+            <key> <string>_bind_names</string> </key>
+            <value>
+              <object>
+                <klass>
+                  <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
+                </klass>
+                <tuple/>
+                <state>
+                  <dictionary>
+                    <item>
+                        <key> <string>_asgns</string> </key>
+                        <value>
+                          <dictionary>
+                            <item>
+                                <key> <string>name_container</string> </key>
+                                <value> <string>container</string> </value>
+                            </item>
+                            <item>
+                                <key> <string>name_context</string> </key>
+                                <value> <string>context</string> </value>
+                            </item>
+                            <item>
+                                <key> <string>name_m_self</string> </key>
+                                <value> <string>script</string> </value>
+                            </item>
+                            <item>
+                                <key> <string>name_subpath</string> </key>
+                                <value> <string>traverse_subpath</string> </value>
+                            </item>
+                          </dictionary>
+                        </value>
+                    </item>
+                  </dictionary>
+                </state>
+              </object>
+            </value>
+        </item>
+        <item>
+            <key> <string>_body</string> </key>
+            <value> <string>movement = context\n
+\n
+parent = movement.getParentValue()\n
+if parent.getPortalType() == \'Applied Rule\':\n
+  parent_rule = parent.getSpecialiseValue()\n
+  if parent_rule.getPortalType() not in [\'Order Simulation Rule\', \'Production Order Simulation Rule\']:\n
+    return False\n
+\n
+source_section = movement.getSourceSection()\n
+destination_section = movement.getDestinationSection()\n
+if source_section == destination_section or source_section is None \\\n
+    or destination_section is None:\n
+  return False\n
+\n
+return True\n
+</string> </value>
+        </item>
+        <item>
+            <key> <string>_code</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>_params</string> </key>
+            <value> <string>rule</string> </value>
+        </item>
+        <item>
+            <key> <string>errors</string> </key>
+            <value>
+              <tuple/>
+            </value>
+        </item>
+        <item>
+            <key> <string>func_code</string> </key>
+            <value>
+              <object>
+                <klass>
+                  <global name="FuncCode" module="Shared.DC.Scripts.Signature"/>
+                </klass>
+                <tuple/>
+                <state>
+                  <dictionary>
+                    <item>
+                        <key> <string>co_argcount</string> </key>
+                        <value> <int>1</int> </value>
+                    </item>
+                    <item>
+                        <key> <string>co_varnames</string> </key>
+                        <value>
+                          <tuple>
+                            <string>rule</string>
+                            <string>context</string>
+                            <string>movement</string>
+                            <string>_getattr_</string>
+                            <string>parent</string>
+                            <string>parent_rule</string>
+                            <string>False</string>
+                            <string>source_section</string>
+                            <string>destination_section</string>
+                            <string>None</string>
+                            <string>True</string>
+                          </tuple>
+                        </value>
+                    </item>
+                  </dictionary>
+                </state>
+              </object>
+            </value>
+        </item>
+        <item>
+            <key> <string>func_defaults</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>SimulationMovement_testDeliveringSimulationRule</string> </value>
+        </item>
+        <item>
+            <key> <string>warnings</string> </key>
+            <value>
+              <tuple/>
+            </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>
diff --git a/bt5/erp5_trade/bt/template_action_path_list b/bt5/erp5_trade/bt/template_action_path_list
index 297841aee0..1e31279cd9 100644
--- a/bt5/erp5_trade/bt/template_action_path_list
+++ b/bt5/erp5_trade/bt/template_action_path_list
@@ -8,6 +8,7 @@ Business State | view
 Container Line | view
 Container Line | view_quantity
 Container | view
+Delivering Simulation Rule | view
 Delivery Cell | view
 Delivery Rule | view
 First Causality Movement Group | view
@@ -33,6 +34,7 @@ Inventory Module | view_stock_report
 Inventory | inventory_fast_input
 Inventory | view
 Order Rule | view
+Order Simulation Rule | view
 Organisation | jump_to_purchase_order
 Organisation | jump_to_purchase_packing_list
 Organisation | jump_to_sale_order
diff --git a/bt5/erp5_trade/bt/template_portal_type_allowed_content_type_list b/bt5/erp5_trade/bt/template_portal_type_allowed_content_type_list
index b104a56652..e8b1c3db94 100644
--- a/bt5/erp5_trade/bt/template_portal_type_allowed_content_type_list
+++ b/bt5/erp5_trade/bt/template_portal_type_allowed_content_type_list
@@ -4,6 +4,9 @@ Business Process | Business State
 Container Line | Container Cell
 Container | Container
 Container | Container Line
+Delivering Simulation Rule | Category Divergence Tester
+Delivering Simulation Rule | Property Divergence Tester
+Delivering Simulation Rule | Quantity Divergence Tester
 Delivery Builder | First Causality Movement Group
 Delivery Rule | Category Divergence Tester
 Delivery Rule | Property Divergence Tester
@@ -17,6 +20,9 @@ Inventory | Inventory Line
 Order Rule | Category Divergence Tester
 Order Rule | Property Divergence Tester
 Order Rule | Quantity Divergence Tester
+Order Simulation Rule | Category Divergence Tester
+Order Simulation Rule | Property Divergence Tester
+Order Simulation Rule | Quantity Divergence Tester
 Preference | Sale Order
 Purchase Order Line | Purchase Order Cell
 Purchase Order Line | Purchase Order Line
diff --git a/bt5/erp5_trade/bt/template_portal_type_id_list b/bt5/erp5_trade/bt/template_portal_type_id_list
index cd1f4b1e97..86b22c2050 100644
--- a/bt5/erp5_trade/bt/template_portal_type_id_list
+++ b/bt5/erp5_trade/bt/template_portal_type_id_list
@@ -5,6 +5,7 @@ Business State
 Container
 Container Cell
 Container Line
+Delivering Simulation Rule
 Delivery Cell
 Delivery Rule
 First Causality Movement Group
@@ -17,6 +18,7 @@ Inventory Cell
 Inventory Line
 Inventory Module
 Order Rule
+Order Simulation Rule
 Payment Condition
 Purchase Order
 Purchase Order Cell
diff --git a/bt5/erp5_trade/bt/template_portal_type_workflow_chain_list b/bt5/erp5_trade/bt/template_portal_type_workflow_chain_list
index 3ef225cf8c..65d3ecba84 100644
--- a/bt5/erp5_trade/bt/template_portal_type_workflow_chain_list
+++ b/bt5/erp5_trade/bt/template_portal_type_workflow_chain_list
@@ -11,6 +11,8 @@ Container Line | pricing_interaction_workflow
 Container Line | trade_matrix_workflow
 Container | edit_workflow
 Container | pricing_interaction_workflow
+Delivering Simulation Rule | edit_workflow
+Delivering Simulation Rule | rule_validation_workflow
 Delivery Cell | delivery_movement_causality_interaction_workflow
 Delivery Cell | delivery_movement_simulation_interaction_workflow
 Delivery Rule | edit_workflow
@@ -37,6 +39,8 @@ Inventory | edit_workflow
 Inventory | inventory_workflow
 Order Rule | edit_workflow
 Order Rule | rule_validation_workflow
+Order Simulation Rule | edit_workflow
+Order Simulation Rule | rule_validation_workflow
 Payment Condition | edit_workflow
 Purchase Order Cell | edit_workflow
 Purchase Order Cell | order_movement_simulation_interaction_workflow
-- 
2.30.9