From 52cc44db9d6ad82ff57d4c8e26082e381ba42e59 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com>
Date: Thu, 26 Jun 2008 09:03:21 +0000
Subject: [PATCH] Adds an interaction workflow to update cell range when
 changing variation settings categories on a pay sheet model.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@21928 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../workflow_chain_type.xml                   |   2 +-
 .../paysheet_model_interaction_workflow.xml   |  61 ++++++++
 .../interactions.xml                          |  37 +++++
 .../interactions/update_cell_range.xml        |  93 ++++++++++++
 .../scripts.xml                               |  37 +++++
 .../scripts/PaySheetModel_updateCellRange.xml | 141 ++++++++++++++++++
 .../variables.xml                             |  31 ++++
 .../worklists.xml                             |  31 ++++
 bt5/erp5_payroll/bt/revision                  |   2 +-
 .../template_portal_type_workflow_chain_list  |   1 +
 bt5/erp5_payroll/bt/template_workflow_id_list |   1 +
 11 files changed, 435 insertions(+), 2 deletions(-)
 create mode 100644 bt5/erp5_payroll/WorkflowTemplateItem/portal_workflow/paysheet_model_interaction_workflow.xml
 create mode 100644 bt5/erp5_payroll/WorkflowTemplateItem/portal_workflow/paysheet_model_interaction_workflow/interactions.xml
 create mode 100644 bt5/erp5_payroll/WorkflowTemplateItem/portal_workflow/paysheet_model_interaction_workflow/interactions/update_cell_range.xml
 create mode 100644 bt5/erp5_payroll/WorkflowTemplateItem/portal_workflow/paysheet_model_interaction_workflow/scripts.xml
 create mode 100644 bt5/erp5_payroll/WorkflowTemplateItem/portal_workflow/paysheet_model_interaction_workflow/scripts/PaySheetModel_updateCellRange.xml
 create mode 100644 bt5/erp5_payroll/WorkflowTemplateItem/portal_workflow/paysheet_model_interaction_workflow/variables.xml
 create mode 100644 bt5/erp5_payroll/WorkflowTemplateItem/portal_workflow/paysheet_model_interaction_workflow/worklists.xml

diff --git a/bt5/erp5_payroll/PortalTypeWorkflowChainTemplateItem/workflow_chain_type.xml b/bt5/erp5_payroll/PortalTypeWorkflowChainTemplateItem/workflow_chain_type.xml
index 24dba49a85..b30b068431 100644
--- a/bt5/erp5_payroll/PortalTypeWorkflowChainTemplateItem/workflow_chain_type.xml
+++ b/bt5/erp5_payroll/PortalTypeWorkflowChainTemplateItem/workflow_chain_type.xml
@@ -9,7 +9,7 @@
  </chain>
  <chain>
   <type>Pay Sheet Model</type>
-  <workflow>validation_workflow, edit_workflow</workflow>
+  <workflow>paysheet_model_interaction_workflow, validation_workflow, edit_workflow</workflow>
  </chain>
  <chain>
   <type>Pay Sheet Model Line</type>
diff --git a/bt5/erp5_payroll/WorkflowTemplateItem/portal_workflow/paysheet_model_interaction_workflow.xml b/bt5/erp5_payroll/WorkflowTemplateItem/portal_workflow/paysheet_model_interaction_workflow.xml
new file mode 100644
index 0000000000..20f977026a
--- /dev/null
+++ b/bt5/erp5_payroll/WorkflowTemplateItem/portal_workflow/paysheet_model_interaction_workflow.xml
@@ -0,0 +1,61 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <tuple>
+        <global name="InteractionWorkflowDefinition" module="Products.ERP5.InteractionWorkflow"/>
+        <tuple/>
+      </tuple>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>__ac_local_roles__</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>_objects</string> </key>
+            <value>
+              <tuple/>
+            </value>
+        </item>
+        <item>
+            <key> <string>_owner</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>creation_guard</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>description</string> </key>
+            <value> <string>Updates cell range when variation settings categories changed</string> </value>
+        </item>
+        <item>
+            <key> <string>groups</string> </key>
+            <value>
+              <tuple/>
+            </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>paysheet_model_interaction_workflow</string> </value>
+        </item>
+        <item>
+            <key> <string>manager_bypass</string> </key>
+            <value> <int>0</int> </value>
+        </item>
+        <item>
+            <key> <string>title</string> </key>
+            <value> <string>Interaction Workflow Definition</string> </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>
diff --git a/bt5/erp5_payroll/WorkflowTemplateItem/portal_workflow/paysheet_model_interaction_workflow/interactions.xml b/bt5/erp5_payroll/WorkflowTemplateItem/portal_workflow/paysheet_model_interaction_workflow/interactions.xml
new file mode 100644
index 0000000000..879a78b540
--- /dev/null
+++ b/bt5/erp5_payroll/WorkflowTemplateItem/portal_workflow/paysheet_model_interaction_workflow/interactions.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <tuple>
+        <global name="Interaction" module="Products.ERP5.Interaction"/>
+        <tuple/>
+      </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_payroll/WorkflowTemplateItem/portal_workflow/paysheet_model_interaction_workflow/interactions/update_cell_range.xml b/bt5/erp5_payroll/WorkflowTemplateItem/portal_workflow/paysheet_model_interaction_workflow/interactions/update_cell_range.xml
new file mode 100644
index 0000000000..382f33b2ce
--- /dev/null
+++ b/bt5/erp5_payroll/WorkflowTemplateItem/portal_workflow/paysheet_model_interaction_workflow/interactions/update_cell_range.xml
@@ -0,0 +1,93 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <tuple>
+        <global name="InteractionDefinition" module="Products.ERP5.Interaction"/>
+        <tuple/>
+      </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>PaySheetModel_updateCellRange</string>
+              </list>
+            </value>
+        </item>
+        <item>
+            <key> <string>description</string> </key>
+            <value> <string>When variation settings category list changes, this means that the slices will be set on this model or delegated to another model. In both cases, we have to update the cell range, either to be able to create new cell, or to have contained cells deleted so that PaySheetModel.getCell gets the value on the inherited model.</string> </value>
+        </item>
+        <item>
+            <key> <string>guard</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>update_cell_range</string> </value>
+        </item>
+        <item>
+            <key> <string>method_id</string> </key>
+            <value>
+              <list>
+                <string>_setVariationSettingsCategoryList</string>
+              </list>
+            </value>
+        </item>
+        <item>
+            <key> <string>once_per_transaction</string> </key>
+            <value> <int>0</int> </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_payroll/WorkflowTemplateItem/portal_workflow/paysheet_model_interaction_workflow/scripts.xml b/bt5/erp5_payroll/WorkflowTemplateItem/portal_workflow/paysheet_model_interaction_workflow/scripts.xml
new file mode 100644
index 0000000000..66683dde04
--- /dev/null
+++ b/bt5/erp5_payroll/WorkflowTemplateItem/portal_workflow/paysheet_model_interaction_workflow/scripts.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <tuple>
+        <global name="Scripts" module="Products.DCWorkflow.Scripts"/>
+        <tuple/>
+      </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_payroll/WorkflowTemplateItem/portal_workflow/paysheet_model_interaction_workflow/scripts/PaySheetModel_updateCellRange.xml b/bt5/erp5_payroll/WorkflowTemplateItem/portal_workflow/paysheet_model_interaction_workflow/scripts/PaySheetModel_updateCellRange.xml
new file mode 100644
index 0000000000..172e3a3376
--- /dev/null
+++ b/bt5/erp5_payroll/WorkflowTemplateItem/portal_workflow/paysheet_model_interaction_workflow/scripts/PaySheetModel_updateCellRange.xml
@@ -0,0 +1,141 @@
+<?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>Python_magic</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>Script_magic</string> </key>
+            <value> <int>3</int> </value>
+        </item>
+        <item>
+            <key> <string>__ac_local_roles__</string> </key>
+            <value>
+              <none/>
+            </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>sci[\'object\'].updateCellRange(base_id=\'cell\')\n
+</string> </value>
+        </item>
+        <item>
+            <key> <string>_code</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>_filepath</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>_params</string> </key>
+            <value> <string>sci</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>sci</string>
+                            <string>_getattr_</string>
+                            <string>_getitem_</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>PaySheetModel_updateCellRange</string> </value>
+        </item>
+        <item>
+            <key> <string>warnings</string> </key>
+            <value>
+              <tuple/>
+            </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>
diff --git a/bt5/erp5_payroll/WorkflowTemplateItem/portal_workflow/paysheet_model_interaction_workflow/variables.xml b/bt5/erp5_payroll/WorkflowTemplateItem/portal_workflow/paysheet_model_interaction_workflow/variables.xml
new file mode 100644
index 0000000000..733d9ce458
--- /dev/null
+++ b/bt5/erp5_payroll/WorkflowTemplateItem/portal_workflow/paysheet_model_interaction_workflow/variables.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <tuple>
+        <global name="Variables" module="Products.DCWorkflow.Variables"/>
+        <tuple/>
+      </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_payroll/WorkflowTemplateItem/portal_workflow/paysheet_model_interaction_workflow/worklists.xml b/bt5/erp5_payroll/WorkflowTemplateItem/portal_workflow/paysheet_model_interaction_workflow/worklists.xml
new file mode 100644
index 0000000000..3953ad0209
--- /dev/null
+++ b/bt5/erp5_payroll/WorkflowTemplateItem/portal_workflow/paysheet_model_interaction_workflow/worklists.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <tuple>
+        <global name="Worklists" module="Products.DCWorkflow.Worklists"/>
+        <tuple/>
+      </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_payroll/bt/revision b/bt5/erp5_payroll/bt/revision
index 2c136b29b5..4d85316228 100644
--- a/bt5/erp5_payroll/bt/revision
+++ b/bt5/erp5_payroll/bt/revision
@@ -1 +1 @@
-302
\ No newline at end of file
+308
\ No newline at end of file
diff --git a/bt5/erp5_payroll/bt/template_portal_type_workflow_chain_list b/bt5/erp5_payroll/bt/template_portal_type_workflow_chain_list
index d7d64844cf..a86787ad07 100644
--- a/bt5/erp5_payroll/bt/template_portal_type_workflow_chain_list
+++ b/bt5/erp5_payroll/bt/template_portal_type_workflow_chain_list
@@ -6,6 +6,7 @@ Pay Sheet Line | delivery_movement_simulation_interaction_workflow
 Pay Sheet Line | edit_workflow
 Pay Sheet Model Line | edit_workflow
 Pay Sheet Model | edit_workflow
+Pay Sheet Model | paysheet_model_interaction_workflow
 Pay Sheet Model | validation_workflow
 Pay Sheet Transaction Line | delivery_movement_causality_interaction_workflow
 Pay Sheet Transaction Line | delivery_movement_simulation_interaction_workflow
diff --git a/bt5/erp5_payroll/bt/template_workflow_id_list b/bt5/erp5_payroll/bt/template_workflow_id_list
index e69de29bb2..55d9b02090 100644
--- a/bt5/erp5_payroll/bt/template_workflow_id_list
+++ b/bt5/erp5_payroll/bt/template_workflow_id_list
@@ -0,0 +1 @@
+paysheet_model_interaction_workflow
\ No newline at end of file
-- 
2.30.9