Commit 08cea86c authored by Jérome Perrin's avatar Jérome Perrin

Research Item Report: various fixes

parent 84ed891f
...@@ -53,6 +53,8 @@ ...@@ -53,6 +53,8 @@
<value> <string encoding="cdata"><![CDATA[ <value> <string encoding="cdata"><![CDATA[
inventory_kw = {}\n inventory_kw = {}\n
if multiplier in (None, \'\'):\n
multiplier = 1.0\n
inventory_kw["at_date"] = at_date\n inventory_kw["at_date"] = at_date\n
inventory_kw["from_date"] = from_date\n inventory_kw["from_date"] = from_date\n
inventory_kw["quantity"] = "<0"\n inventory_kw["quantity"] = "<0"\n
...@@ -62,7 +64,6 @@ if multiplier is None:\n ...@@ -62,7 +64,6 @@ if multiplier is None:\n
multiplier = 1\n multiplier = 1\n
\n \n
portal = context.getPortalObject()\n portal = context.getPortalObject()\n
\n
simulation_state_set = set(simulation_state_list)\n simulation_state_set = set(simulation_state_list)\n
# We will use inventory API in order to find all quantities\n # We will use inventory API in order to find all quantities\n
before_confirmed_task_state_set = set(portal.getPortalPlannedOrderStateList() + \\\n before_confirmed_task_state_set = set(portal.getPortalPlannedOrderStateList() + \\\n
...@@ -110,14 +111,14 @@ def getColumnUrl(brain=None, column_id=None, **kw):\n ...@@ -110,14 +111,14 @@ def getColumnUrl(brain=None, column_id=None, **kw):\n
absolute_url = portal.absolute_url()\n absolute_url = portal.absolute_url()\n
\n \n
if len(summary_dict):\n if len(summary_dict):\n
for person in portal.portal_catalog(portal_type="Person", uid=summary_dict.keys(), select_list=["title"]):\n for person in portal.portal_catalog(portal_type=("Person", "Organisation"), uid=summary_dict.keys(), select_list=["title"]):\n
person_title_dict[person.uid] = person.title\n person_title_dict[person.uid] = person.title\n
for person_uid in summary_dict.keys():\n for person_uid in summary_dict.keys():\n
person_kw = summary_dict[person_uid]\n person_kw = summary_dict[person_uid]\n
person_kw["source_title"] = person_title_dict[person_uid]\n person_kw["source_title"] = person_title_dict[person_uid]\n
person = portal.person_module.newContent(temp_object=1, **person_kw)\n person = portal.person_module.newContent(temp_object=1, **person_kw)\n
for item_url in summary_dict[person_uid].keys():\n for item_url in summary_dict[person_uid].keys():\n
task_report_module_url = "%s/task_report_module/view?reset:int=1&default_source_uid=%s" % (absolute_url, person_uid)\n task_report_module_url = "%s/task_report_module/view?reset:int=1&default_source_uid=%s&title=%%" % (absolute_url, person_uid)\n
if item_url == "None":\n if item_url == "None":\n
task_report_module_url += "&child_aggregate_relative_url=%%3dNULL&left_join_list=child_aggregate_relative_url&journal_relative_url=journal/%s" % \\\n task_report_module_url += "&child_aggregate_relative_url=%%3dNULL&left_join_list=child_aggregate_relative_url&journal_relative_url=journal/%s" % \\\n
(journal, )\n (journal, )\n
...@@ -128,6 +129,7 @@ if len(summary_dict):\n ...@@ -128,6 +129,7 @@ if len(summary_dict):\n
person.setProperty("getColumnUrl", getColumnUrl)\n person.setProperty("getColumnUrl", getColumnUrl)\n
listbox_line_list.append(person)\n listbox_line_list.append(person)\n
\n \n
listbox_line_list.sort(key=lambda x: x.getProperty("source_title"))\n
# now add an extra line for total\n # now add an extra line for total\n
person = portal.person_module.newContent(temp_object=1, source_title="Total", **total_project_dict)\n person = portal.person_module.newContent(temp_object=1, source_title="Total", **total_project_dict)\n
listbox_line_list.append(person)\n listbox_line_list.append(person)\n
...@@ -139,9 +141,11 @@ if item_url_set:\n ...@@ -139,9 +141,11 @@ if item_url_set:\n
item_title_dict["None"] = "undefined"\n item_title_dict["None"] = "undefined"\n
\n \n
# define which property to display in columns\n # define which property to display in columns\n
column_list = [("source_title", "Worker")]\n column_list = [("source_title", "Worker"),\n
for item_url, item_title in item_title_dict.items():\n ("None", "Undefined"), ]\n
column_list.append((item_url, item_title))\n for item_url, item_title in sorted(item_title_dict.items(), key=lambda url_title: url_title[1]):\n
if item_url != \'None\':\n
column_list.append((item_url, item_title))\n
column_list.append(("total", "Total"))\n column_list.append(("total", "Total"))\n
\n \n
# define which script to display url in columns\n # define which script to display url in columns\n
...@@ -149,16 +153,15 @@ column_url_script_list = []\n ...@@ -149,16 +153,15 @@ column_url_script_list = []\n
for item_url in item_title_dict.keys():\n for item_url in item_title_dict.keys():\n
column_url_script_list.append((item_url, "getColumnUrl"))\n column_url_script_list.append((item_url, "getColumnUrl"))\n
\n \n
context_kw = {}\n context = context.asContext(column_list=column_list,\n
context_kw.update(column_list=column_list,\n at_date=at_date,\n
at_date=at_date,\n from_date=from_date,\n
from_date=from_date,\n simulation_state_list=simulation_state_list,\n
simulation_state_list=simulation_state_list,\n column_url_script_list=column_url_script_list,\n
column_url_script_list=column_url_script_list,\n journal=journal,\n
journal=journal,\n multiplier=multiplier,\n
multiplier=multiplier,\n listbox_line_list=listbox_line_list)\n
listbox_line_list=listbox_line_list)\n \n
context = context.getObject().asContext(**context_kw)\n
if batch_mode:\n if batch_mode:\n
return context\n return context\n
return context.ResearchItemModule_viewResearchSummaryReportData()\n return context.ResearchItemModule_viewResearchSummaryReportData()\n
......
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