Commit 5b15b0f9 authored by Sebastien Robin's avatar Sebastien Robin

Improve the monthly report :

- display a summary of time spend for the full period in another listbox
- add report a project module level in order to display results
for many projects at a time

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@43626 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 84296c59
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ActionInformation" module="Products.CMFCore.ActionInformation"/>
</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_report</string>
</tuple>
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_report</string> </value>
</item>
<item>
<key> <string>condition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>icon</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>worker_monthly_report</string> </value>
</item>
<item>
<key> <string>permissions</string> </key>
<value>
<tuple>
<string>View</string>
</tuple>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Action Information</string> </value>
</item>
<item>
<key> <string>priority</string> </key>
<value> <float>1.0</float> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Worker Monthly Report</string> </value>
</item>
<item>
<key> <string>visible</string> </key>
<value> <int>1</int> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Expression" module="Products.CMFCore.Expression"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>string:${object_url}/ProjectModule_viewODSMonthlyReportPrintDialog</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ERP5Form" module="Products.ERP5Form.Form"/>
</pickle>
<pickle>
<dictionary>
<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/>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>action</string> </key>
<value> <string>Project_viewMonthlyReport</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>edit_order</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>encoding</string> </key>
<value> <string>UTF-8</string> </value>
</item>
<item>
<key> <string>enctype</string> </key>
<value> <string>multipart/form-data</string> </value>
</item>
<item>
<key> <string>group_list</string> </key>
<value>
<list>
<string>left</string>
<string>right</string>
</list>
</value>
</item>
<item>
<key> <string>groups</string> </key>
<value>
<dictionary>
<item>
<key> <string>left</string> </key>
<value>
<list>
<string>your_report_depth</string>
<string>your_worker_title_list</string>
</list>
</value>
</item>
<item>
<key> <string>right</string> </key>
<value>
<list>
<string>your_simulation_state</string>
<string>your_from_date</string>
<string>your_at_date</string>
</list>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ProjectModule_viewODSMonthlyReportPrintDialog</string> </value>
</item>
<item>
<key> <string>method</string> </key>
<value> <string>POST</string> </value>
</item>
<item>
<key> <string>name</string> </key>
<value> <string>Project_viewODSMonthlyPrintDialog</string> </value>
</item>
<item>
<key> <string>pt</string> </key>
<value> <string>form_dialog</string> </value>
</item>
<item>
<key> <string>row_length</string> </key>
<value> <int>4</int> </value>
</item>
<item>
<key> <string>stored_encoding</string> </key>
<value> <string>UTF-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Monthly Report</string> </value>
</item>
<item>
<key> <string>unicode_mode</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>update_action</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>update_action_title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>required</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>your_at_date</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string>your_at_date</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Project_viewDialogFieldLibrary</string> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>required</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>your_from_date</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string>your_from_date</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Project_viewDialogFieldLibrary</string> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="IntegerField" module="Products.Formulator.StandardFields"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>your_report_depth</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
<item>
<key> <string>integer_out_of_range</string> </key>
<value> <string>The integer you entered was out of range.</string> </value>
</item>
<item>
<key> <string>not_integer</string> </key>
<value> <string>You did not enter an integer.</string> </value>
</item>
<item>
<key> <string>required_not_found</string> </key>
<value> <string>Input is required but no input given.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_maxwidth</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_width</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>end</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>start</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>whitespace_preserve</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_maxwidth</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_width</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>end</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>start</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>whitespace_preserve</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string>5</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_maxwidth</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_width</string> </key>
<value> <int>20</int> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>end</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>start</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Report Depth</string> </value>
</item>
<item>
<key> <string>whitespace_preserve</string> </key>
<value> <int>0</int> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>your_simulation_state</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string>your_simulation_state</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Project_viewDialogFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -76,6 +76,12 @@ if depth == 0:\n ...@@ -76,6 +76,12 @@ if depth == 0:\n
current_month = None\n current_month = None\n
# We must initialize from_date at the beginning of the month\n # We must initialize from_date at the beginning of the month\n
current_date = from_date\n current_date = from_date\n
is_total = here.is_total\n
if is_total:\n
category_list.append(here.getObject().asContext(title=here.full_date_string,\n
string_index=here.full_date_string,\n
))\n
else:\n
month_dict = request.form.get(\'month_dict\', None)\n month_dict = request.form.get(\'month_dict\', None)\n
if month_dict is None:\n if month_dict is None:\n
month_dict = {}\n month_dict = {}\n
...@@ -94,14 +100,14 @@ if depth == 0:\n ...@@ -94,14 +100,14 @@ if depth == 0:\n
request.form[\'month_dict\'] = month_dict\n request.form[\'month_dict\'] = month_dict\n
\n \n
category_list = []\n category_list = []\n
i = 1\n #i = 1\n
month_dict_list = month_dict.keys()\n month_dict_list = month_dict.keys()\n
month_dict_list.sort()\n month_dict_list.sort()\n
for year, month in month_dict_list:\n for year, month in month_dict_list:\n
category_list.append(here.getObject().asContext(title="%s - %s" % (year, month),\n category_list.append(here.getObject().asContext(title="%s - %s" % (year, month),\n
string_index="%s-%s" % (year, month),\n string_index="%s-%s" % (year, month),\n
))\n ))\n
i += 1\n #i += 1\n
\n \n
else:\n else:\n
object_dict = here.object_dict\n object_dict = here.object_dict\n
...@@ -110,8 +116,8 @@ else:\n ...@@ -110,8 +116,8 @@ else:\n
object_url_dict = {}\n object_url_dict = {}\n
project_to_display_dict = here.monthly_project_to_display_dict.get(string_index, {})\n project_to_display_dict = here.monthly_project_to_display_dict.get(string_index, {})\n
if depth == 1:\n if depth == 1:\n
category_list = [x for x in here.project_list \n category_list = [here.project_dict[x] for x in project_to_display_dict.keys() if\n
if project_to_display_dict.has_key(x.getRelativeUrl())]\n here.project_dict.has_key(x)]\n
else:\n else:\n
parent_category_list = parent.getMembershipCriterionCategoryList()\n parent_category_list = parent.getMembershipCriterionCategoryList()\n
category_list = []\n category_list = []\n
......
...@@ -61,16 +61,24 @@ current_criterion = object_domain.getCriterionList()\n ...@@ -61,16 +61,24 @@ current_criterion = object_domain.getCriterionList()\n
date = current_criterion[0].identity\n date = current_criterion[0].identity\n
result_list = []\n result_list = []\n
if len(object_domain.getMembershipCriterionBaseCategoryList())==0:\n if len(object_domain.getMembershipCriterionBaseCategoryList())==0:\n
# First level, so level of month\n # First level, so level of month, we display summary of total\n
# quantity per worker for the full month\n
returned_object = summary_dict.get(date, None)\n returned_object = summary_dict.get(date, None)\n
if returned_object is not None:\n if returned_object is not None:\n
result_list.append(returned_object)\n result_list.append(returned_object)\n
else:\n else:\n
returned_object = object_dict.get(date, None)\n returned_object = object_dict.get(date, None)\n
if returned_object is not None:\n if returned_object is not None:\n
for k,v in returned_object.items():\n # optimisation, in this report we have exactly one temp object at most\n
if object_domain.test(v, strict_membership=1):\n # matching our domain, and we have already a dict with nice keys, so\n
result_list.append(v)\n # there is no need to parse all temp objects\n
membership_criterion_category_list = object_domain.getMembershipCriterionCategoryList()\n
assert len(membership_criterion_category_list) == 1\n
membership_criterion_category = membership_criterion_category_list[0]\n
assert membership_criterion_category.startswith(\'source_project/\')\n
project_relative_url = membership_criterion_category[len(\'source_project/\'):]\n
if returned_object.has_key(project_relative_url):\n
result_list.append(returned_object[project_relative_url])\n
return result_list\n return result_list\n
</string> </value> </string> </value>
</item> </item>
......
...@@ -53,15 +53,17 @@ ...@@ -53,15 +53,17 @@
<value> <string>context = context.asContext(object_dict=object_dict,\n <value> <string>context = context.asContext(object_dict=object_dict,\n
summary_dict=summary_dict,\n summary_dict=summary_dict,\n
column_list=column_list,\n column_list=column_list,\n
project_list=project_list,\n project_dict=project_dict,\n
monthly_project_to_display_dict=monthly_project_to_display_dict)\n monthly_project_to_display_dict=monthly_project_to_display_dict,\n
is_total=is_total,\n
full_date_string=full_date_string)\n
\n \n
return context\n return context\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>object_dict, summary_dict, column_list, project_list, monthly_project_to_display_dict,**kw</string> </value> <value> <string>object_dict, summary_dict, column_list, project_dict, monthly_project_to_display_dict,is_total, full_date_string,**kw</string> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
......
...@@ -55,8 +55,10 @@ ...@@ -55,8 +55,10 @@
from Products.ZSQLCatalog.SQLCatalog import Query\n from Products.ZSQLCatalog.SQLCatalog import Query\n
request = context.REQUEST\n request = context.REQUEST\n
\n \n
object_dict = {} # it contains required temp object to display the report\n object_dict = {} # it contains required temp object to display the listbox\n
total_object_dict = {}\n # with the amount of time per worker/month/project line\n
total_object_dict = {} # this is for listbox with amount of time\n
# per worker/project line\n
\n \n
column_list= []\n column_list= []\n
worker_column_list = []\n worker_column_list = []\n
...@@ -82,6 +84,8 @@ if at_date is None:\n ...@@ -82,6 +84,8 @@ if at_date is None:\n
at_date = context.getStopDate()\n at_date = context.getStopDate()\n
request.set(\'at_date\',at_date)\n request.set(\'at_date\',at_date)\n
simulation_state = request.get(\'simulation_state\', None)\n simulation_state = request.get(\'simulation_state\', None)\n
full_date_string = "%s-%s -> %s-%s" % (from_date.year(), from_date.month(),\n
at_date.year(), at_date.month())\n
\n \n
\n \n
\n \n
...@@ -93,13 +97,39 @@ result_list = portal.portal_simulation.getInventoryList(\n ...@@ -93,13 +97,39 @@ result_list = portal.portal_simulation.getInventoryList(\n
at_date=at_date, **inventory_kw)\n at_date=at_date, **inventory_kw)\n
\n \n
monthly_worker_quantity_dict = {} # Used to get quantity per month and per worker\n monthly_worker_quantity_dict = {} # Used to get quantity per month and per worker\n
# and per project line\n
monthly_project_to_display_dict = {} # Used to get project urls to display per month\n monthly_project_to_display_dict = {} # Used to get project urls to display per month\n
# in the report tree\n # in the report tree\n
total_project_to_display_dict = {} # Used to get project urls to display in the summary\n
total_worker_quantity_dict = {} # Used to get quantity per project line and per worker for\n
# the full period\n
full_date_total_worker_quantity_dict = \\\n
total_worker_quantity_dict.setdefault(full_date_string, {})\n
full_date_total_object_dict = total_object_dict.setdefault(full_date_string, {})\n
full_date_total_project_to_display_dict = \\\n
total_project_to_display_dict.setdefault(full_date_string, {})\n
\n
\n \n
source_uid_dict = {}\n source_uid_dict = {}\n
project_uid_dict = {}\n project_uid_dict = {}\n
project_relative_url_dict = {}\n project_relative_url_dict = {}\n
\n \n
def fillDictWithParentAndChildRelativeUrls(my_dict, document_url):\n
if my_dict.get(document_url) is None:\n
splitted_document_url = document_url.split(\'/\')\n
for x in xrange(0, len(splitted_document_url)):\n
my_dict[\'/\'.join(splitted_document_url[0:x+1])] = 1\n
\n
\n
def getNextMonthStart(date):\n
"""\n
return the next month date of the param date\n
"""\n
if date.month()==12:\n
return DateTime(date.year()+1, date.month(), 1)\n
else:\n
return DateTime(date.year(), date.month()+1, 1)\n
\n
for task_line in result_list:\n for task_line in result_list:\n
# initialize some variables\n # initialize some variables\n
source_uid = task_line.node_uid\n source_uid = task_line.node_uid\n
...@@ -135,17 +165,23 @@ for task_line in result_list:\n ...@@ -135,17 +165,23 @@ for task_line in result_list:\n
project_relative_url_dict[\'/\'.join(project_value.getRelativeUrl().split(\'/\')[0:2])] = 1\n project_relative_url_dict[\'/\'.join(project_value.getRelativeUrl().split(\'/\')[0:2])] = 1\n
quantity = - task_line.inventory\n quantity = - task_line.inventory\n
project_relative_url = project_dict[\'relative_url\']\n project_relative_url = project_dict[\'relative_url\']\n
full_date_total_worker_quantity_dict[source_relative_url] = \\\n
full_date_total_worker_quantity_dict.get(source_relative_url, 0) + quantity\n
if not full_date_total_object_dict.has_key(project_relative_url):\n
temp_object = temp_object_container.newContent(portal_type = \'Project Line\',\n
temp_object=1,\n
string_index = full_date_string,\n
category_list = [\'source_project/%s\' % project_relative_url])\n
full_date_total_object_dict[project_relative_url] = temp_object\n
current_temp_object = full_date_total_object_dict[project_relative_url]\n
object_quantity = quantity + current_temp_object.getProperty(source_relative_url, 0)\n
current_temp_object.setProperty(source_relative_url, object_quantity)\n
\n
# diff in day between the begin and the end of the task\n # diff in day between the begin and the end of the task\n
diff_day = stop_date_task - start_date_task + 1\n diff_day = stop_date_task - start_date_task + 1\n
\n \n
def getNextMonthStart(date):\n fillDictWithParentAndChildRelativeUrls(full_date_total_project_to_display_dict, \n
"""\n project_relative_url)\n
return the next month date of the param date\n
"""\n
if date.month()==12:\n
return DateTime(date.year()+1, date.month(), 1)\n
else:\n
return DateTime(date.year(), date.month()+1, 1)\n
\n \n
timekeeper = start_date_task\n timekeeper = start_date_task\n
while timekeeper <= stop_date_task :\n while timekeeper <= stop_date_task :\n
...@@ -155,10 +191,7 @@ for task_line in result_list:\n ...@@ -155,10 +191,7 @@ for task_line in result_list:\n
\n \n
worker_quantity_dict = monthly_worker_quantity_dict.setdefault(string_index, {})\n worker_quantity_dict = monthly_worker_quantity_dict.setdefault(string_index, {})\n
project_to_display_dict = monthly_project_to_display_dict.setdefault(string_index, {})\n project_to_display_dict = monthly_project_to_display_dict.setdefault(string_index, {})\n
if project_to_display_dict.get(project_relative_url, None) is None:\n fillDictWithParentAndChildRelativeUrls(project_to_display_dict, project_relative_url)\n
splitted_project_url = project_relative_url.split(\'/\')\n
for x in xrange(0, len(splitted_project_url)):\n
project_to_display_dict[\'/\'.join(splitted_project_url[0:x+1])] = 1\n
\n \n
if not quantity_dict.has_key(project_relative_url):\n if not quantity_dict.has_key(project_relative_url):\n
temp_object = temp_object_container.newContent(portal_type = \'Project Line\',\n temp_object = temp_object_container.newContent(portal_type = \'Project Line\',\n
...@@ -183,6 +216,16 @@ for string_index, worker_quantity_dict in monthly_worker_quantity_dict.items():\ ...@@ -183,6 +216,16 @@ for string_index, worker_quantity_dict in monthly_worker_quantity_dict.items():\
for source_relative_url, quantity in worker_quantity_dict.items():\n for source_relative_url, quantity in worker_quantity_dict.items():\n
temp_object.setProperty(source_relative_url, quantity)\n temp_object.setProperty(source_relative_url, quantity)\n
\n \n
# Now build temp objects for quantity per worker\n
total_summary_dict = {}\n
for string_index, worker_quantity_dict in total_worker_quantity_dict.items():\n
temp_object = temp_object_container.newContent(portal_type = \'Project Line\',\n
temp_object=1,\n
string_index = string_index)\n
total_summary_dict[string_index] = temp_object\n
for source_relative_url, quantity in worker_quantity_dict.items():\n
temp_object.setProperty(source_relative_url, quantity)\n
\n
column_list.extend(worker_column_list)\n column_list.extend(worker_column_list)\n
\n \n
selection_name = \'project_monthly_report_selection\'\n selection_name = \'project_monthly_report_selection\'\n
...@@ -193,11 +236,11 @@ result = []\n ...@@ -193,11 +236,11 @@ result = []\n
from Products.ERP5Form.Report import ReportSection\n from Products.ERP5Form.Report import ReportSection\n
param_dict = {}\n param_dict = {}\n
\n \n
project_list = []\n project_dict = {}\n
for project_relative_url in project_relative_url_dict.keys():\n for project_relative_url in project_relative_url_dict.keys():\n
project_list.append(portal.restrictedTraverse(project_relative_url))\n project_dict[project_relative_url] = portal.restrictedTraverse(project_relative_url)\n
param_list = [object_dict, summary_dict, column_list, project_list,\n param_list = [object_dict, summary_dict, column_list, project_dict,\n
monthly_project_to_display_dict]\n monthly_project_to_display_dict, False, full_date_string]\n
\n \n
result.append(ReportSection(\n result.append(ReportSection(\n
path=context.getPhysicalPath(),\n path=context.getPhysicalPath(),\n
...@@ -205,6 +248,15 @@ result.append(ReportSection(\n ...@@ -205,6 +248,15 @@ result.append(ReportSection(\n
method_id=\'Project_getMonthlyReportContext\',\n method_id=\'Project_getMonthlyReportContext\',\n
listbox_display_mode=\'ReportTreeMode\',\n listbox_display_mode=\'ReportTreeMode\',\n
form_id=\'Project_viewMonthlyReportData\'))\n form_id=\'Project_viewMonthlyReportData\'))\n
\n
param_list = [total_object_dict, total_summary_dict, column_list, project_dict,\n
total_project_to_display_dict, True, full_date_string]\n
result.append(ReportSection(\n
path=context.getPhysicalPath(),\n
param_list=param_list,\n
method_id=\'Project_getMonthlyReportContext\',\n
listbox_display_mode=\'ReportTreeMode\',\n
form_id=\'Project_viewMonthlySummaryReportData\'))\n
return result\n return result\n
......
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>"""Initialize an unique codification on project, because projects are often used as security group.\n <value> <string>"""Initialize an unique codification on project, because projects are often used as security group.\n
"""\n """\n
codification = context.getPortalObject().portal_ids.generateNewId(id_group=\'project.codification\', id_generator=\'uid\', default=1)\n codification = context.getPortalObject().portal_ids.generateNewLengthId(id_group=\'project.codification\', default=1)\n
context.setCodification(\'PROJ-%s\' % codification)\n context.setCodification(\'PROJ-%s\' % codification)\n
</string> </value> </string> </value>
</item> </item>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ERP5Form" module="Products.ERP5Form.Form"/>
</pickle>
<pickle>
<dictionary>
<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/>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>action</string> </key>
<value> <string>Project_getObjectDateDict</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>edit_order</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>encoding</string> </key>
<value> <string>UTF-8</string> </value>
</item>
<item>
<key> <string>enctype</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>group_list</string> </key>
<value>
<list>
<string>left</string>
<string>right</string>
<string>center</string>
<string>bottom</string>
<string>hidden</string>
</list>
</value>
</item>
<item>
<key> <string>groups</string> </key>
<value>
<dictionary>
<item>
<key> <string>bottom</string> </key>
<value>
<list>
<string>listbox</string>
</list>
</value>
</item>
<item>
<key> <string>center</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>hidden</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>left</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>right</string> </key>
<value>
<list/>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Project_viewMonthlySummaryReportData</string> </value>
</item>
<item>
<key> <string>method</string> </key>
<value> <string>POST</string> </value>
</item>
<item>
<key> <string>name</string> </key>
<value> <string>Project_viewMonthlyReport</string> </value>
</item>
<item>
<key> <string>pt</string> </key>
<value> <string>form_dialog</string> </value>
</item>
<item>
<key> <string>row_length</string> </key>
<value> <int>4</int> </value>
</item>
<item>
<key> <string>stored_encoding</string> </key>
<value> <string>UTF-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Monthly Report</string> </value>
</item>
<item>
<key> <string>unicode_mode</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>update_action</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
788 793
\ No newline at end of file \ No newline at end of file
...@@ -17,6 +17,7 @@ Project Milestone | create_new_file ...@@ -17,6 +17,7 @@ Project Milestone | create_new_file
Project Milestone | document_list Project Milestone | document_list
Project Milestone | view Project Milestone | view
Project Module | view Project Module | view
Project Module | worker_monthly_report
Project | add_task_related Project | add_task_related
Project | bug_list Project | bug_list
Project | content Project | content
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment