From 21fa87bf76cbb80175bbd51b5f2eb8b5ca686d34 Mon Sep 17 00:00:00 2001
From: Yoshinori Okuji <yo@nexedi.com>
Date: Thu, 20 Sep 2007 07:51:12 +0000
Subject: [PATCH] 2007-09-20 yo * Set Source Project on Task Report, if all
 lines share the same Source Project. * Show Source Project in Task Report
 Module. * Enable Report Tree Mode in Task Report Module. * Add an optional
 column into Task_viewTaskList to show the state of a Task Report
 corresponding to each Task.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@16488 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../TaskModule_viewTaskList/listbox.xml       |  64 ++++++--
 .../listbox.xml                               |  63 +++-----
 ...t_copyOrderPropertiesAndNotifyAssignee.xml |  26 ++-
 ...skReportTranslatedSimulationStateTitle.xml | 150 ++++++++++++++++++
 bt5/erp5_project/bt/change_log                |   6 +
 bt5/erp5_project/bt/revision                  |   2 +-
 6 files changed, 251 insertions(+), 60 deletions(-)
 create mode 100644 bt5/erp5_project/SkinTemplateItem/portal_skins/erp5_project/Task_getTaskReportTranslatedSimulationStateTitle.xml

diff --git a/bt5/erp5_project/SkinTemplateItem/portal_skins/erp5_project/TaskModule_viewTaskList/listbox.xml b/bt5/erp5_project/SkinTemplateItem/portal_skins/erp5_project/TaskModule_viewTaskList/listbox.xml
index e35778fcde..ae8c3b9f7c 100644
--- a/bt5/erp5_project/SkinTemplateItem/portal_skins/erp5_project/TaskModule_viewTaskList/listbox.xml
+++ b/bt5/erp5_project/SkinTemplateItem/portal_skins/erp5_project/TaskModule_viewTaskList/listbox.xml
@@ -3,11 +3,8 @@
   <record id="1" aka="AAAAAAAAAAE=">
     <pickle>
       <tuple>
-        <tuple>
-          <string>Products.ERP5Form.ListBox</string>
-          <string>ListBox</string>
-        </tuple>
-        <none/>
+        <global name="ListBox" module="Products.ERP5Form.ListBox"/>
+        <tuple/>
       </tuple>
     </pickle>
     <pickle>
@@ -322,7 +319,48 @@
                 <item>
                     <key> <string>all_columns</string> </key>
                     <value>
-                      <list/>
+                      <list>
+                        <tuple>
+                          <string>title</string>
+                          <string>Title</string>
+                        </tuple>
+                        <tuple>
+                          <string>source_project_title</string>
+                          <string>Project</string>
+                        </tuple>
+                        <tuple>
+                          <string>delivery.start_date</string>
+                          <string>Starting</string>
+                        </tuple>
+                        <tuple>
+                          <string>delivery.stop_date</string>
+                          <string>Due</string>
+                        </tuple>
+                        <tuple>
+                          <string>destination_title</string>
+                          <string>Deliverable to</string>
+                        </tuple>
+                        <tuple>
+                          <string>source_title</string>
+                          <string>Assigned to</string>
+                        </tuple>
+                        <tuple>
+                          <string>total_quantity</string>
+                          <string>Total</string>
+                        </tuple>
+                        <tuple>
+                          <string>task_line_quantity_unit_title</string>
+                          <string>Unit</string>
+                        </tuple>
+                        <tuple>
+                          <string>translated_simulation_state_title</string>
+                          <string>State</string>
+                        </tuple>
+                        <tuple>
+                          <string>Task_getTaskReportTranslatedSimulationStateTitle</string>
+                          <string>Report State</string>
+                        </tuple>
+                      </list>
                     </value>
                 </item>
                 <item>
@@ -562,11 +600,8 @@
   <record id="2" aka="AAAAAAAAAAI=">
     <pickle>
       <tuple>
-        <tuple>
-          <string>Products.Formulator.MethodField</string>
-          <string>Method</string>
-        </tuple>
-        <none/>
+        <global name="Method" module="Products.Formulator.MethodField"/>
+        <tuple/>
       </tuple>
     </pickle>
     <pickle>
@@ -581,11 +616,8 @@
   <record id="3" aka="AAAAAAAAAAM=">
     <pickle>
       <tuple>
-        <tuple>
-          <string>Products.Formulator.MethodField</string>
-          <string>Method</string>
-        </tuple>
-        <none/>
+        <global name="Method" module="Products.Formulator.MethodField"/>
+        <tuple/>
       </tuple>
     </pickle>
     <pickle>
diff --git a/bt5/erp5_project/SkinTemplateItem/portal_skins/erp5_project/TaskReportModule_viewTaskReportList/listbox.xml b/bt5/erp5_project/SkinTemplateItem/portal_skins/erp5_project/TaskReportModule_viewTaskReportList/listbox.xml
index 5493cdfe21..74fd0b776c 100644
--- a/bt5/erp5_project/SkinTemplateItem/portal_skins/erp5_project/TaskReportModule_viewTaskReportList/listbox.xml
+++ b/bt5/erp5_project/SkinTemplateItem/portal_skins/erp5_project/TaskReportModule_viewTaskReportList/listbox.xml
@@ -313,40 +313,7 @@
                 <item>
                     <key> <string>all_columns</string> </key>
                     <value>
-                      <list>
-                        <tuple>
-                          <string>title</string>
-                          <string>Title</string>
-                        </tuple>
-                        <tuple>
-                          <string>delivery.start_date</string>
-                          <string>Starting</string>
-                        </tuple>
-                        <tuple>
-                          <string>delivery.stop_date</string>
-                          <string>Due</string>
-                        </tuple>
-                        <tuple>
-                          <string>destination_title</string>
-                          <string>Deliverable to</string>
-                        </tuple>
-                        <tuple>
-                          <string>source_title</string>
-                          <string>Assigned to</string>
-                        </tuple>
-                        <tuple>
-                          <string>total_quantity</string>
-                          <string>Total</string>
-                        </tuple>
-                        <tuple>
-                          <string>quantity_unit_title</string>
-                          <string>Unit</string>
-                        </tuple>
-                        <tuple>
-                          <string>translated_simulation_state_title</string>
-                          <string>State</string>
-                        </tuple>
-                      </list>
+                      <list/>
                     </value>
                 </item>
                 <item>
@@ -367,6 +334,10 @@
                           <string>title</string>
                           <string>Title</string>
                         </tuple>
+                        <tuple>
+                          <string>source_project_title</string>
+                          <string>Project</string>
+                        </tuple>
                         <tuple>
                           <string>delivery.start_date</string>
                           <string>Starting</string>
@@ -400,7 +371,9 @@
                 </item>
                 <item>
                     <key> <string>count_method</string> </key>
-                    <value> <string></string> </value>
+                    <value>
+                      <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
+                    </value>
                 </item>
                 <item>
                     <key> <string>css_class</string> </key>
@@ -478,7 +451,7 @@
                 <item>
                     <key> <string>list_method</string> </key>
                     <value>
-                      <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
+                      <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
                     </value>
                 </item>
                 <item>
@@ -519,7 +492,7 @@
                 </item>
                 <item>
                     <key> <string>report_tree</string> </key>
-                    <value> <int>0</int> </value>
+                    <value> <int>1</int> </value>
                 </item>
                 <item>
                     <key> <string>search</string> </key>
@@ -578,6 +551,22 @@
     </pickle>
   </record>
   <record id="2" aka="AAAAAAAAAAI=">
+    <pickle>
+      <tuple>
+        <global name="Method" module="Products.Formulator.MethodField"/>
+        <tuple/>
+      </tuple>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>method_name</string> </key>
+            <value> <string>countFolder</string> </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+  <record id="3" aka="AAAAAAAAAAM=">
     <pickle>
       <tuple>
         <global name="Method" module="Products.Formulator.MethodField"/>
diff --git a/bt5/erp5_project/SkinTemplateItem/portal_skins/erp5_project/TaskReport_copyOrderPropertiesAndNotifyAssignee.xml b/bt5/erp5_project/SkinTemplateItem/portal_skins/erp5_project/TaskReport_copyOrderPropertiesAndNotifyAssignee.xml
index 19bfae8368..9ff07ecfe6 100644
--- a/bt5/erp5_project/SkinTemplateItem/portal_skins/erp5_project/TaskReport_copyOrderPropertiesAndNotifyAssignee.xml
+++ b/bt5/erp5_project/SkinTemplateItem/portal_skins/erp5_project/TaskReport_copyOrderPropertiesAndNotifyAssignee.xml
@@ -73,15 +73,25 @@ packing_list.PackingList_copyOrderProperties()\n
 packing_list = context\n
 related_order = packing_list.getCausalityValue()\n
 \n
-if packing_list.getSimulationState()==\'draft\':\n
+if packing_list.getSimulationState() == \'draft\':\n
   packing_list.edit(\n
-    comment = related_order.getComment(),\n
-    delivery_mode = related_order.getDeliveryMode(),\n
-    incoterm = related_order.getIncoterm(),\n
-    source_administration_value = related_order.getSourceAdministrationValue(),\n
-    title = related_order.getTitle()\n
+    comment=related_order.getComment(),\n
+    delivery_mode=related_order.getDeliveryMode(),\n
+    incoterm=related_order.getIncoterm(),\n
+    source_administration_value=related_order.getSourceAdministrationValue(),\n
+    title=related_order.getTitle()\n
   )\n
 \n
+  # Copy Source Project only if all Task Report Lines share the same value.\n
+  marker = source_project_value = []\n
+  for packing_list_line in packing_list.contentValues(filter={\'portal_type\': \'Task Report Line\'}):\n
+    if source_project_value is marker:\n
+      source_project_value = packing_list_line.getSourceProjectValue()\n
+    elif source_project_value != packing_list_line.getSourceProjectValue():\n
+      source_project_value = marker\n
+      break\n
+  if source_project_value is not marker:\n
+    packing_list.setSourceProjectValue(source_project_value)\n
 \n
 # If security definitions are implemented on the packing list, it is time to apply them\n
 packing_list.assignRoleToSecurityGroup()\n
@@ -178,6 +188,10 @@ packing_list.activate(after_method_id=(\'immediateReindexObject\',\'recursiveImm
                             <string>packing_list</string>
                             <string>_getattr_</string>
                             <string>related_order</string>
+                            <string>marker</string>
+                            <string>source_project_value</string>
+                            <string>_getiter_</string>
+                            <string>packing_list_line</string>
                             <string>source_person</string>
                             <string>destination_decision_person</string>
                             <string>None</string>
diff --git a/bt5/erp5_project/SkinTemplateItem/portal_skins/erp5_project/Task_getTaskReportTranslatedSimulationStateTitle.xml b/bt5/erp5_project/SkinTemplateItem/portal_skins/erp5_project/Task_getTaskReportTranslatedSimulationStateTitle.xml
new file mode 100644
index 0000000000..e43fcf584a
--- /dev/null
+++ b/bt5/erp5_project/SkinTemplateItem/portal_skins/erp5_project/Task_getTaskReportTranslatedSimulationStateTitle.xml
@@ -0,0 +1,150 @@
+<?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>task_report = context.getCausalityRelatedValue(portal_type=\'Task Report\')\n
+if task_report is not None:\n
+  return task_report.getTranslatedSimulationStateTitle()\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>_owner</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>_params</string> </key>
+            <value> <string></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>0</int> </value>
+                    </item>
+                    <item>
+                        <key> <string>co_varnames</string> </key>
+                        <value>
+                          <tuple>
+                            <string>_getattr_</string>
+<string>context</string>
+                            <string>task_report</string>
+                            <string>None</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>Task_getTaskReportTranslatedSimulationStateTitle</string> </value>
+        </item>
+        <item>
+            <key> <string>warnings</string> </key>
+            <value>
+              <tuple/>
+            </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>
diff --git a/bt5/erp5_project/bt/change_log b/bt5/erp5_project/bt/change_log
index 889fff241e..3ee9507036 100644
--- a/bt5/erp5_project/bt/change_log
+++ b/bt5/erp5_project/bt/change_log
@@ -1,3 +1,9 @@
+2007-09-20 yo
+* Set Source Project on Task Report, if all lines share the same Source Project.
+* Show Source Project in Task Report Module.
+* Enable Report Tree Mode in Task Report Module.
+* Add an optional column into Task_viewTaskList to show the state of a Task Report corresponding to each Task.
+
 2007-09-20 yo
 * Fix an undefined symbol.
 
diff --git a/bt5/erp5_project/bt/revision b/bt5/erp5_project/bt/revision
index 8975db9a05..65de5029b4 100644
--- a/bt5/erp5_project/bt/revision
+++ b/bt5/erp5_project/bt/revision
@@ -1 +1 @@
-293
\ No newline at end of file
+294
\ No newline at end of file
-- 
2.30.9