From dd3c7dbdfcb5d5c420d0d72b48ca3aff444d4770 Mon Sep 17 00:00:00 2001
From: Sebastien Robin <seb@nexedi.com>
Date: Wed, 2 Aug 2006 10:32:26 +0000
Subject: [PATCH] Use interaction workflow when we update an currency exchange
 line

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@8983 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../erp5_base/CurrencyExchangeLine_view.xml   | 14 +--
 .../interactions.xml                          | 40 ++++++++
 .../CurrencyExchangeLine_edit.xml             | 92 +++++++++++++++++++
 .../scripts.xml                               | 40 ++++++++
 .../CurrencyExchangeLine_updateMatrix.xml}    | 30 ++----
 .../variables.xml                             | 34 +++++++
 .../worklists.xml                             | 34 +++++++
 .../template_portal_type_workflow_chain_list  |  1 +
 bt5/erp5_base/bt/template_workflow_id_list    |  3 +-
 9 files changed, 259 insertions(+), 29 deletions(-)
 create mode 100644 bt5/erp5_base/WorkflowTemplateItem/portal_workflow/currency_exchange_line_interaction_workflow/interactions.xml
 create mode 100644 bt5/erp5_base/WorkflowTemplateItem/portal_workflow/currency_exchange_line_interaction_workflow/interactions/CurrencyExchangeLine_edit.xml
 create mode 100644 bt5/erp5_base/WorkflowTemplateItem/portal_workflow/currency_exchange_line_interaction_workflow/scripts.xml
 rename bt5/erp5_base/{SkinTemplateItem/portal_skins/erp5_base/CurrencyExchangeLine_edit.xml => WorkflowTemplateItem/portal_workflow/currency_exchange_line_interaction_workflow/scripts/CurrencyExchangeLine_updateMatrix.xml} (84%)
 create mode 100644 bt5/erp5_base/WorkflowTemplateItem/portal_workflow/currency_exchange_line_interaction_workflow/variables.xml
 create mode 100644 bt5/erp5_base/WorkflowTemplateItem/portal_workflow/currency_exchange_line_interaction_workflow/worklists.xml

diff --git a/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/CurrencyExchangeLine_view.xml b/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/CurrencyExchangeLine_view.xml
index a96c0c41fa..bd143537b7 100644
--- a/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/CurrencyExchangeLine_view.xml
+++ b/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/CurrencyExchangeLine_view.xml
@@ -53,7 +53,7 @@
         </item>
         <item>
             <key> <string>action</string> </key>
-            <value> <string>CurrencyExchangeLine_edit</string> </value>
+            <value> <string>Base_edit</string> </value>
         </item>
         <item>
             <key> <string>encoding</string> </key>
@@ -80,7 +80,7 @@
             <value>
               <dictionary>
                 <item>
-                    <key>                 <string>bottom</string> </key>
+                    <key> <string>bottom</string> </key>
                     <value>
                       <list>
                         <string>listbox</string>
@@ -88,7 +88,7 @@
                     </value>
                 </item>
                 <item>
-                    <key>                 <string>center</string> </key>
+                    <key> <string>center</string> </key>
                     <value>
                       <list>
                         <string>my_start_date</string>
@@ -97,7 +97,7 @@
                     </value>
                 </item>
                 <item>
-                    <key>                 <string>hidden</string> </key>
+                    <key> <string>hidden</string> </key>
                     <value>
                       <list>
                         <string>listbox_base_price</string>
@@ -106,16 +106,16 @@
                     </value>
                 </item>
                 <item>
-                    <key>                 <string>left</string> </key>
+                    <key> <string>left</string> </key>
                     <value>
                       <list>
                         <string>my_title</string>
-                        <string>my_price_currency_id</string>
+                        <string>my_price_currency_title</string>
                       </list>
                     </value>
                 </item>
                 <item>
-                    <key>                 <string>right</string> </key>
+                    <key> <string>right</string> </key>
                     <value>
                       <list>
                         <string>my_source_title</string>
diff --git a/bt5/erp5_base/WorkflowTemplateItem/portal_workflow/currency_exchange_line_interaction_workflow/interactions.xml b/bt5/erp5_base/WorkflowTemplateItem/portal_workflow/currency_exchange_line_interaction_workflow/interactions.xml
new file mode 100644
index 0000000000..7d8c51003b
--- /dev/null
+++ b/bt5/erp5_base/WorkflowTemplateItem/portal_workflow/currency_exchange_line_interaction_workflow/interactions.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <tuple>
+        <tuple>
+          <string>Products.ERP5.Interaction</string>
+          <string>Interaction</string>
+        </tuple>
+        <none/>
+      </tuple>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>__ac_local_roles__</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>_mapping</string> </key>
+            <value>
+              <dictionary/>
+            </value>
+        </item>
+        <item>
+            <key> <string>_objects</string> </key>
+            <value>
+              <tuple/>
+            </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>interactions</string> </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>
diff --git a/bt5/erp5_base/WorkflowTemplateItem/portal_workflow/currency_exchange_line_interaction_workflow/interactions/CurrencyExchangeLine_edit.xml b/bt5/erp5_base/WorkflowTemplateItem/portal_workflow/currency_exchange_line_interaction_workflow/interactions/CurrencyExchangeLine_edit.xml
new file mode 100644
index 0000000000..6ee1d850b4
--- /dev/null
+++ b/bt5/erp5_base/WorkflowTemplateItem/portal_workflow/currency_exchange_line_interaction_workflow/interactions/CurrencyExchangeLine_edit.xml
@@ -0,0 +1,92 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <tuple>
+        <tuple>
+          <string>Products.ERP5.Interaction</string>
+          <string>InteractionDefinition</string>
+        </tuple>
+        <none/>
+      </tuple>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>__ac_local_roles__</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>actbox_category</string> </key>
+            <value> <string>workflow</string> </value>
+        </item>
+        <item>
+            <key> <string>actbox_name</string> </key>
+            <value> <string></string> </value>
+        </item>
+        <item>
+            <key> <string>actbox_url</string> </key>
+            <value> <string></string> </value>
+        </item>
+        <item>
+            <key> <string>activate_script_name</string> </key>
+            <value>
+              <tuple/>
+            </value>
+        </item>
+        <item>
+            <key> <string>after_script_name</string> </key>
+            <value>
+              <list>
+                <string>CurrencyExchangeLine_updateMatrix</string>
+              </list>
+            </value>
+        </item>
+        <item>
+            <key> <string>description</string> </key>
+            <value> <string></string> </value>
+        </item>
+        <item>
+            <key> <string>guard</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>CurrencyExchangeLine_edit</string> </value>
+        </item>
+        <item>
+            <key> <string>method_id</string> </key>
+            <value>
+              <list>
+                <string>_edit</string>
+              </list>
+            </value>
+        </item>
+        <item>
+            <key> <string>portal_type_filter</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>script_name</string> </key>
+            <value>
+              <tuple/>
+            </value>
+        </item>
+        <item>
+            <key> <string>title</string> </key>
+            <value> <string></string> </value>
+        </item>
+        <item>
+            <key> <string>trigger_type</string> </key>
+            <value> <int>2</int> </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>
diff --git a/bt5/erp5_base/WorkflowTemplateItem/portal_workflow/currency_exchange_line_interaction_workflow/scripts.xml b/bt5/erp5_base/WorkflowTemplateItem/portal_workflow/currency_exchange_line_interaction_workflow/scripts.xml
new file mode 100644
index 0000000000..01ba35bf25
--- /dev/null
+++ b/bt5/erp5_base/WorkflowTemplateItem/portal_workflow/currency_exchange_line_interaction_workflow/scripts.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <tuple>
+        <tuple>
+          <string>Products.DCWorkflow.Scripts</string>
+          <string>Scripts</string>
+        </tuple>
+        <none/>
+      </tuple>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>__ac_local_roles__</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>_mapping</string> </key>
+            <value>
+              <dictionary/>
+            </value>
+        </item>
+        <item>
+            <key> <string>_objects</string> </key>
+            <value>
+              <tuple/>
+            </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>scripts</string> </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>
diff --git a/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/CurrencyExchangeLine_edit.xml b/bt5/erp5_base/WorkflowTemplateItem/portal_workflow/currency_exchange_line_interaction_workflow/scripts/CurrencyExchangeLine_updateMatrix.xml
similarity index 84%
rename from bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/CurrencyExchangeLine_edit.xml
rename to bt5/erp5_base/WorkflowTemplateItem/portal_workflow/currency_exchange_line_interaction_workflow/scripts/CurrencyExchangeLine_updateMatrix.xml
index 9de74a0a12..2f24ebd3e4 100644
--- a/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/CurrencyExchangeLine_edit.xml
+++ b/bt5/erp5_base/WorkflowTemplateItem/portal_workflow/currency_exchange_line_interaction_workflow/scripts/CurrencyExchangeLine_updateMatrix.xml
@@ -68,11 +68,12 @@
         </item>
         <item>
             <key> <string>_body</string> </key>
-            <value> <string>base_value = context.Base_edit(form_id, selection_index=selection_index, selection_name=selection_name, dialog_id=dialog_id)\n
+            <value> <string>context = state_change.object\n
 \n
 base_id = \'path\'\n
 kwd = {\'base_id\': base_id}\n
 \n
+\n
 context.updateCellRange(script_id=\'CurrencyExchangeLine_asCellRange\', base_id=base_id)\n
 cell_range_key_list = context.getCellRangeKeyList(base_id = base_id)\n
 \n
@@ -88,8 +89,6 @@ if cell_range_key_list != [[None, None]] :\n
            category_list = category_list,\n
     )\n
     c.setCriterion(\'stop_date\', min=context.getStartDate(), max=context.getStopDate())\n
-\n
-return base_value\n
 </string> </value>
         </item>
         <item>
@@ -100,17 +99,13 @@ return base_value\n
         </item>
         <item>
             <key> <string>_filepath</string> </key>
-            <value> <string>Script (Python):/nexedi/portal_skins/erp5_base/CurrencyExchangeLine_edit</string> </value>
-        </item>
-        <item>
-            <key> <string>_owner</string> </key>
             <value>
               <none/>
             </value>
         </item>
         <item>
             <key> <string>_params</string> </key>
-            <value> <string>form_id, selection_index=0, selection_name=\'\',dialog_id=\'\'</string> </value>
+            <value> <string>state_change, **kw</string> </value>
         </item>
         <item>
             <key> <string>errors</string> </key>
@@ -130,19 +125,16 @@ return base_value\n
                   <dictionary>
                     <item>
                         <key> <string>co_argcount</string> </key>
-                        <value> <int>4</int> </value>
+                        <value> <int>1</int> </value>
                     </item>
                     <item>
                         <key> <string>co_varnames</string> </key>
                         <value>
                           <tuple>
-                            <string>form_id</string>
-                            <string>selection_index</string>
-                            <string>selection_name</string>
-                            <string>dialog_id</string>
+                            <string>state_change</string>
+                            <string>kw</string>
                             <string>_getattr_</string>
-                            <string>context</string>
-                            <string>base_value</string>
+<string>context</string>
                             <string>base_id</string>
                             <string>kwd</string>
                             <string>cell_range_key_list</string>
@@ -169,16 +161,12 @@ return base_value\n
         <item>
             <key> <string>func_defaults</string> </key>
             <value>
-              <tuple>
-                <int>0</int>
-                <string></string>
-                <string></string>
-              </tuple>
+              <none/>
             </value>
         </item>
         <item>
             <key> <string>id</string> </key>
-            <value> <string>CurrencyExchangeLine_edit</string> </value>
+            <value> <string>CurrencyExchangeLine_updateMatrix</string> </value>
         </item>
         <item>
             <key> <string>warnings</string> </key>
diff --git a/bt5/erp5_base/WorkflowTemplateItem/portal_workflow/currency_exchange_line_interaction_workflow/variables.xml b/bt5/erp5_base/WorkflowTemplateItem/portal_workflow/currency_exchange_line_interaction_workflow/variables.xml
new file mode 100644
index 0000000000..db67387d4e
--- /dev/null
+++ b/bt5/erp5_base/WorkflowTemplateItem/portal_workflow/currency_exchange_line_interaction_workflow/variables.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <tuple>
+        <tuple>
+          <string>Products.DCWorkflow.Variables</string>
+          <string>Variables</string>
+        </tuple>
+        <none/>
+      </tuple>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>__ac_local_roles__</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>_mapping</string> </key>
+            <value>
+              <dictionary/>
+            </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>variables</string> </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>
diff --git a/bt5/erp5_base/WorkflowTemplateItem/portal_workflow/currency_exchange_line_interaction_workflow/worklists.xml b/bt5/erp5_base/WorkflowTemplateItem/portal_workflow/currency_exchange_line_interaction_workflow/worklists.xml
new file mode 100644
index 0000000000..f4c2789633
--- /dev/null
+++ b/bt5/erp5_base/WorkflowTemplateItem/portal_workflow/currency_exchange_line_interaction_workflow/worklists.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <tuple>
+        <tuple>
+          <string>Products.DCWorkflow.Worklists</string>
+          <string>Worklists</string>
+        </tuple>
+        <none/>
+      </tuple>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>__ac_local_roles__</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>_mapping</string> </key>
+            <value>
+              <dictionary/>
+            </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>worklists</string> </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>
diff --git a/bt5/erp5_base/bt/template_portal_type_workflow_chain_list b/bt5/erp5_base/bt/template_portal_type_workflow_chain_list
index d854445944..d7cd207c8c 100644
--- a/bt5/erp5_base/bt/template_portal_type_workflow_chain_list
+++ b/bt5/erp5_base/bt/template_portal_type_workflow_chain_list
@@ -7,6 +7,7 @@ Bank Account | edit_workflow
 Career | career_workflow
 ChatAddress | edit_workflow
 Credit Card | edit_workflow
+Currency Exchange Line | currency_exchange_line_interaction_workflow
 Currency Exchange Line | edit_workflow
 Currency | edit_workflow
 Email | edit_workflow
diff --git a/bt5/erp5_base/bt/template_workflow_id_list b/bt5/erp5_base/bt/template_workflow_id_list
index 2372ce3c02..29e8ce02cc 100644
--- a/bt5/erp5_base/bt/template_workflow_id_list
+++ b/bt5/erp5_base/bt/template_workflow_id_list
@@ -1,3 +1,4 @@
 assignment_workflow
 bank_account_workflow
-career_workflow
\ No newline at end of file
+career_workflow
+currency_exchange_line_interaction_workflow
\ No newline at end of file
-- 
2.30.9