From 62413ea30a7a0a7fb2f1cdd714f3cde7f2aaf9f8 Mon Sep 17 00:00:00 2001
From: Alexandre Boeglin <alex@nexedi.com>
Date: Thu, 6 Sep 2007 09:11:06 +0000
Subject: [PATCH] * remove whitespaces at the end of interaction ids that
 result in "%20" in the filenames * do not call edit recursively, simply call
 the appropriate script instead

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@16105 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../delivery_edit_workflow/interactions.xml   |  7 +++--
 ...=> DeliveryCell_edit_UpdateSimulation.xml} |  9 ++++--
 .../DeliveryLine_edit_UpdateSimulation.xml    |  7 +++--
 ...angeSimulationState_ReindexSimulation.xml} |  9 ++++--
 .../Delivery_edit_UpdateSimulation.xml        |  7 +++--
 .../delivery_edit_workflow/scripts.xml        |  7 +++--
 .../scripts/DeliveryCell_UpdateSimulation.xml | 12 ++++++--
 .../scripts/DeliveryLine_UpdateSimulation.xml | 28 ++++++++++++++-----
 ...ivery_ReindexRelatedSimulationMovement.xml |  7 +++--
 .../scripts/Delivery_UpdateSimulation.xml     | 23 +++++++++++----
 .../delivery_edit_workflow/variables.xml      |  7 +++--
 .../delivery_edit_workflow/worklists.xml      |  7 +++--
 bt5/erp5_trade/bt/revision                    |  2 +-
 13 files changed, 95 insertions(+), 37 deletions(-)
 rename bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/delivery_edit_workflow/interactions/{DeliveryCell_edit_UpdateSimulation%20%20%20.xml => DeliveryCell_edit_UpdateSimulation.xml} (91%)
 rename bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/delivery_edit_workflow/interactions/{Delivery_changeSimulationState_ReindexSimulation%20%20%20.xml => Delivery_changeSimulationState_ReindexSimulation.xml} (94%)

diff --git a/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/delivery_edit_workflow/interactions.xml b/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/delivery_edit_workflow/interactions.xml
index 879a78b540..7d8c51003b 100644
--- a/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/delivery_edit_workflow/interactions.xml
+++ b/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/delivery_edit_workflow/interactions.xml
@@ -3,8 +3,11 @@
   <record id="1" aka="AAAAAAAAAAE=">
     <pickle>
       <tuple>
-        <global name="Interaction" module="Products.ERP5.Interaction"/>
-        <tuple/>
+        <tuple>
+          <string>Products.ERP5.Interaction</string>
+          <string>Interaction</string>
+        </tuple>
+        <none/>
       </tuple>
     </pickle>
     <pickle>
diff --git a/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/delivery_edit_workflow/interactions/DeliveryCell_edit_UpdateSimulation%20%20%20.xml b/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/delivery_edit_workflow/interactions/DeliveryCell_edit_UpdateSimulation.xml
similarity index 91%
rename from bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/delivery_edit_workflow/interactions/DeliveryCell_edit_UpdateSimulation%20%20%20.xml
rename to bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/delivery_edit_workflow/interactions/DeliveryCell_edit_UpdateSimulation.xml
index 23b7e4dc50..ea8aed8dea 100644
--- a/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/delivery_edit_workflow/interactions/DeliveryCell_edit_UpdateSimulation%20%20%20.xml
+++ b/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/delivery_edit_workflow/interactions/DeliveryCell_edit_UpdateSimulation.xml
@@ -3,8 +3,11 @@
   <record id="1" aka="AAAAAAAAAAE=">
     <pickle>
       <tuple>
-        <global name="InteractionDefinition" module="Products.ERP5.Interaction"/>
-        <tuple/>
+        <tuple>
+          <string>Products.ERP5.Interaction</string>
+          <string>InteractionDefinition</string>
+        </tuple>
+        <none/>
       </tuple>
     </pickle>
     <pickle>
@@ -53,7 +56,7 @@
         </item>
         <item>
             <key> <string>id</string> </key>
-            <value> <string>DeliveryCell_edit_UpdateSimulation   </string> </value>
+            <value> <string>DeliveryCell_edit_UpdateSimulation</string> </value>
         </item>
         <item>
             <key> <string>method_id</string> </key>
diff --git a/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/delivery_edit_workflow/interactions/DeliveryLine_edit_UpdateSimulation.xml b/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/delivery_edit_workflow/interactions/DeliveryLine_edit_UpdateSimulation.xml
index b8dc5175cb..20807cc386 100644
--- a/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/delivery_edit_workflow/interactions/DeliveryLine_edit_UpdateSimulation.xml
+++ b/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/delivery_edit_workflow/interactions/DeliveryLine_edit_UpdateSimulation.xml
@@ -3,8 +3,11 @@
   <record id="1" aka="AAAAAAAAAAE=">
     <pickle>
       <tuple>
-        <global name="InteractionDefinition" module="Products.ERP5.Interaction"/>
-        <tuple/>
+        <tuple>
+          <string>Products.ERP5.Interaction</string>
+          <string>InteractionDefinition</string>
+        </tuple>
+        <none/>
       </tuple>
     </pickle>
     <pickle>
diff --git a/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/delivery_edit_workflow/interactions/Delivery_changeSimulationState_ReindexSimulation%20%20%20.xml b/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/delivery_edit_workflow/interactions/Delivery_changeSimulationState_ReindexSimulation.xml
similarity index 94%
rename from bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/delivery_edit_workflow/interactions/Delivery_changeSimulationState_ReindexSimulation%20%20%20.xml
rename to bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/delivery_edit_workflow/interactions/Delivery_changeSimulationState_ReindexSimulation.xml
index f75935cb1e..f27c19484a 100644
--- a/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/delivery_edit_workflow/interactions/Delivery_changeSimulationState_ReindexSimulation%20%20%20.xml
+++ b/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/delivery_edit_workflow/interactions/Delivery_changeSimulationState_ReindexSimulation.xml
@@ -3,8 +3,11 @@
   <record id="1" aka="AAAAAAAAAAE=">
     <pickle>
       <tuple>
-        <global name="InteractionDefinition" module="Products.ERP5.Interaction"/>
-        <tuple/>
+        <tuple>
+          <string>Products.ERP5.Interaction</string>
+          <string>InteractionDefinition</string>
+        </tuple>
+        <none/>
       </tuple>
     </pickle>
     <pickle>
@@ -55,7 +58,7 @@ FIXME: reindexObjectSecurity is probably not optimal, it may launch  unnecessary
         </item>
         <item>
             <key> <string>id</string> </key>
-            <value> <string>Delivery_changeSimulationState_ReindexSimulation   </string> </value>
+            <value> <string>Delivery_changeSimulationState_ReindexSimulation</string> </value>
         </item>
         <item>
             <key> <string>method_id</string> </key>
diff --git a/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/delivery_edit_workflow/interactions/Delivery_edit_UpdateSimulation.xml b/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/delivery_edit_workflow/interactions/Delivery_edit_UpdateSimulation.xml
index d4cb9ccff2..87f1ab98b3 100644
--- a/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/delivery_edit_workflow/interactions/Delivery_edit_UpdateSimulation.xml
+++ b/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/delivery_edit_workflow/interactions/Delivery_edit_UpdateSimulation.xml
@@ -3,8 +3,11 @@
   <record id="1" aka="AAAAAAAAAAE=">
     <pickle>
       <tuple>
-        <global name="InteractionDefinition" module="Products.ERP5.Interaction"/>
-        <tuple/>
+        <tuple>
+          <string>Products.ERP5.Interaction</string>
+          <string>InteractionDefinition</string>
+        </tuple>
+        <none/>
       </tuple>
     </pickle>
     <pickle>
diff --git a/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/delivery_edit_workflow/scripts.xml b/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/delivery_edit_workflow/scripts.xml
index 66683dde04..01ba35bf25 100644
--- a/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/delivery_edit_workflow/scripts.xml
+++ b/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/delivery_edit_workflow/scripts.xml
@@ -3,8 +3,11 @@
   <record id="1" aka="AAAAAAAAAAE=">
     <pickle>
       <tuple>
-        <global name="Scripts" module="Products.DCWorkflow.Scripts"/>
-        <tuple/>
+        <tuple>
+          <string>Products.DCWorkflow.Scripts</string>
+          <string>Scripts</string>
+        </tuple>
+        <none/>
       </tuple>
     </pickle>
     <pickle>
diff --git a/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/delivery_edit_workflow/scripts/DeliveryCell_UpdateSimulation.xml b/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/delivery_edit_workflow/scripts/DeliveryCell_UpdateSimulation.xml
index 5c0d6745e1..98b0f4c7cb 100644
--- a/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/delivery_edit_workflow/scripts/DeliveryCell_UpdateSimulation.xml
+++ b/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/delivery_edit_workflow/scripts/DeliveryCell_UpdateSimulation.xml
@@ -3,8 +3,11 @@
   <record id="1" aka="AAAAAAAAAAE=">
     <pickle>
       <tuple>
-        <global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
-        <tuple/>
+        <tuple>
+          <string>Products.PythonScripts.PythonScript</string>
+          <string>PythonScript</string>
+        </tuple>
+        <none/>
       </tuple>
     </pickle>
     <pickle>
@@ -66,7 +69,8 @@
         <item>
             <key> <string>_body</string> </key>
             <value> <string># trigger the simulation update from the parent line\n
-sci[\'object\'].getParentValue().edit()\n
+line = sci[\'object\'].getParentValue()\n
+context.DeliveryLine_UpdateSimulation(sci, line)\n
 </string> </value>
         </item>
         <item>
@@ -112,6 +116,8 @@ sci[\'object\'].getParentValue().edit()\n
                             <string>sci</string>
                             <string>_getattr_</string>
                             <string>_getitem_</string>
+                            <string>line</string>
+                            <string>context</string>
                           </tuple>
                         </value>
                     </item>
diff --git a/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/delivery_edit_workflow/scripts/DeliveryLine_UpdateSimulation.xml b/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/delivery_edit_workflow/scripts/DeliveryLine_UpdateSimulation.xml
index 85b20b0f37..93b25a069c 100644
--- a/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/delivery_edit_workflow/scripts/DeliveryLine_UpdateSimulation.xml
+++ b/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/delivery_edit_workflow/scripts/DeliveryLine_UpdateSimulation.xml
@@ -3,8 +3,11 @@
   <record id="1" aka="AAAAAAAAAAE=">
     <pickle>
       <tuple>
-        <global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
-        <tuple/>
+        <tuple>
+          <string>Products.PythonScripts.PythonScript</string>
+          <string>PythonScript</string>
+        </tuple>
+        <none/>
       </tuple>
     </pickle>
     <pickle>
@@ -65,8 +68,13 @@
         </item>
         <item>
             <key> <string>_body</string> </key>
-            <value> <string># trigger the simulation update from the parent invoice\n
-sci[\'object\'].getParentValue().edit()\n
+            <value> <string># trigger the simulation update from the parent delivery\n
+\n
+if obj is None:\n
+  delivery = sci[\'object\'].getParentValue()\n
+else:\n
+  delivery = obj\n
+context.Delivery_UpdateSimulation(sci, delivery)\n
 </string> </value>
         </item>
         <item>
@@ -83,7 +91,7 @@ sci[\'object\'].getParentValue().edit()\n
         </item>
         <item>
             <key> <string>_params</string> </key>
-            <value> <string>sci</string> </value>
+            <value> <string>sci, obj=None</string> </value>
         </item>
         <item>
             <key> <string>errors</string> </key>
@@ -103,15 +111,19 @@ sci[\'object\'].getParentValue().edit()\n
                   <dictionary>
                     <item>
                         <key> <string>co_argcount</string> </key>
-                        <value> <int>1</int> </value>
+                        <value> <int>2</int> </value>
                     </item>
                     <item>
                         <key> <string>co_varnames</string> </key>
                         <value>
                           <tuple>
                             <string>sci</string>
+                            <string>obj</string>
+                            <string>None</string>
                             <string>_getattr_</string>
                             <string>_getitem_</string>
+                            <string>delivery</string>
+                            <string>context</string>
                           </tuple>
                         </value>
                     </item>
@@ -123,7 +135,9 @@ sci[\'object\'].getParentValue().edit()\n
         <item>
             <key> <string>func_defaults</string> </key>
             <value>
-              <none/>
+              <tuple>
+                <none/>
+              </tuple>
             </value>
         </item>
         <item>
diff --git a/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/delivery_edit_workflow/scripts/Delivery_ReindexRelatedSimulationMovement.xml b/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/delivery_edit_workflow/scripts/Delivery_ReindexRelatedSimulationMovement.xml
index 230c786762..74e460d335 100644
--- a/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/delivery_edit_workflow/scripts/Delivery_ReindexRelatedSimulationMovement.xml
+++ b/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/delivery_edit_workflow/scripts/Delivery_ReindexRelatedSimulationMovement.xml
@@ -3,8 +3,11 @@
   <record id="1" aka="AAAAAAAAAAE=">
     <pickle>
       <tuple>
-        <global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
-        <tuple/>
+        <tuple>
+          <string>Products.PythonScripts.PythonScript</string>
+          <string>PythonScript</string>
+        </tuple>
+        <none/>
       </tuple>
     </pickle>
     <pickle>
diff --git a/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/delivery_edit_workflow/scripts/Delivery_UpdateSimulation.xml b/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/delivery_edit_workflow/scripts/Delivery_UpdateSimulation.xml
index 38e4594ee4..5548920462 100644
--- a/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/delivery_edit_workflow/scripts/Delivery_UpdateSimulation.xml
+++ b/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/delivery_edit_workflow/scripts/Delivery_UpdateSimulation.xml
@@ -3,8 +3,11 @@
   <record id="1" aka="AAAAAAAAAAE=">
     <pickle>
       <tuple>
-        <global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
-        <tuple/>
+        <tuple>
+          <string>Products.PythonScripts.PythonScript</string>
+          <string>PythonScript</string>
+        </tuple>
+        <none/>
       </tuple>
     </pickle>
     <pickle>
@@ -72,7 +75,11 @@ It is responsible of updating the applied rule\n
 \n
 """\n
 \n
-delivery = sci[\'object\']\n
+if obj is None:\n
+  delivery = sci[\'object\']\n
+else:\n
+  delivery = obj\n
+\n
 delivery_portal_type = delivery.getPortalType()\n
 portal = sci.getPortal()\n
 LOG = lambda msg:delivery.log("delivery_edit_workflow.Delivery_UpdateSimulation (%s)\\n" % (delivery.getPath()), msg)\n
@@ -122,7 +129,7 @@ LOG(\'END\')\n
         </item>
         <item>
             <key> <string>_params</string> </key>
-            <value> <string>sci</string> </value>
+            <value> <string>sci, obj=None</string> </value>
         </item>
         <item>
             <key> <string>errors</string> </key>
@@ -142,13 +149,15 @@ LOG(\'END\')\n
                   <dictionary>
                     <item>
                         <key> <string>co_argcount</string> </key>
-                        <value> <int>1</int> </value>
+                        <value> <int>2</int> </value>
                     </item>
                     <item>
                         <key> <string>co_varnames</string> </key>
                         <value>
                           <tuple>
                             <string>sci</string>
+                            <string>obj</string>
+                            <string>None</string>
                             <string>_getitem_</string>
                             <string>delivery</string>
                             <string>_getattr_</string>
@@ -171,7 +180,9 @@ LOG(\'END\')\n
         <item>
             <key> <string>func_defaults</string> </key>
             <value>
-              <none/>
+              <tuple>
+                <none/>
+              </tuple>
             </value>
         </item>
         <item>
diff --git a/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/delivery_edit_workflow/variables.xml b/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/delivery_edit_workflow/variables.xml
index 733d9ce458..db67387d4e 100644
--- a/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/delivery_edit_workflow/variables.xml
+++ b/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/delivery_edit_workflow/variables.xml
@@ -3,8 +3,11 @@
   <record id="1" aka="AAAAAAAAAAE=">
     <pickle>
       <tuple>
-        <global name="Variables" module="Products.DCWorkflow.Variables"/>
-        <tuple/>
+        <tuple>
+          <string>Products.DCWorkflow.Variables</string>
+          <string>Variables</string>
+        </tuple>
+        <none/>
       </tuple>
     </pickle>
     <pickle>
diff --git a/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/delivery_edit_workflow/worklists.xml b/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/delivery_edit_workflow/worklists.xml
index 3953ad0209..f4c2789633 100644
--- a/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/delivery_edit_workflow/worklists.xml
+++ b/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/delivery_edit_workflow/worklists.xml
@@ -3,8 +3,11 @@
   <record id="1" aka="AAAAAAAAAAE=">
     <pickle>
       <tuple>
-        <global name="Worklists" module="Products.DCWorkflow.Worklists"/>
-        <tuple/>
+        <tuple>
+          <string>Products.DCWorkflow.Worklists</string>
+          <string>Worklists</string>
+        </tuple>
+        <none/>
       </tuple>
     </pickle>
     <pickle>
diff --git a/bt5/erp5_trade/bt/revision b/bt5/erp5_trade/bt/revision
index 97a55e1d74..ffda4e73f0 100644
--- a/bt5/erp5_trade/bt/revision
+++ b/bt5/erp5_trade/bt/revision
@@ -1 +1 @@
-101
\ No newline at end of file
+105
\ No newline at end of file
-- 
2.30.9