Commit 374a023e authored by Romain Courteaud's avatar Romain Courteaud

Improve performance of project planning box generation.

Configure new domains to display the full list of task/task reports.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@31076 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent ae39d776
......@@ -59,25 +59,22 @@ object_path = request.get(\'object_path\')\n
if object_path is None:\n
object_path = context.REQUEST.get(\'URL1\').split(\'/\')[-1]\n
\n
search_path = \'\'.join(["%project_module/", object_path,"%"])\n
real_context = context.restrictedTraverse(object_path)\n
\n
if depth == 0:\n
category_list = []\n
for line in context.portal_catalog(path=search_path ):\n
category_list.extend([ i for i in line.getObject().getSourceValueList() if i not in category_list])\n
\n
\n
category_list = context.portal_catalog(\n
source_related_relative_url=(real_context.getRelativeUrl(), \'%s/%%\' % real_context.getRelativeUrl()),\n
)\n
else:\n
return domain_list\n
\n
for category in category_list:\n
domain = parent.generateTempDomain(id = \'sub\' + category.getId() )\n
domain.edit(title = category.getTitle(),\n
membership_criterion_base_category = (\'source\', ), \n
membership_criterion_category = (category.getRelativeUrl(),),\n
domain_generator_method_id = script.id,\n
domain = parent.generateTempDomain(id=\'sub%s\' % category.getId())\n
domain.edit(title=category.getTitle(),\n
membership_criterion_base_category=(\'source\',), \n
membership_criterion_category=(category.getRelativeUrl(),),\n
domain_generator_method_id=script.id,\n
uid = category.getUid())\n
\n
domain_list.append(domain)\n
\n
return domain_list\n
......@@ -127,13 +124,9 @@ return domain_list\n
<string>object_path</string>
<string>None</string>
<string>_getitem_</string>
<string>search_path</string>
<string>real_context</string>
<string>category_list</string>
<string>_getiter_</string>
<string>line</string>
<string>append</string>
<string>$append0</string>
<string>i</string>
<string>category</string>
<string>domain</string>
<string>script</string>
......
......@@ -67,7 +67,6 @@ domain_list = []\n
\n
if depth == 0:\n
category_list = [context.project_module.restrictedTraverse(object_path)]\n
\n
else:\n
category_list = []\n
parent_category_list = parent.getMembershipCriterionCategoryList()\n
......@@ -80,7 +79,7 @@ for category in category_list:\n
domain = parent.generateTempDomain(id = \'%s_%s\' % (depth, i))\n
domain.edit(title = category.getTitle(),\n
membership_criterion_base_category = (\'source_project\', ), \n
membership_criterion_category = (category.getRelativeUrl(),),\n
membership_criterion_category = (category.getRelativeUrl(), ),\n
domain_generator_method_id = script.id,\n
uid = category.getUid())\n
i += 1\n
......
......@@ -58,33 +58,28 @@
selection_tool = context.portal_selections\n
selection = selection_tool.getSelectionFor(\'project_planning_selection\')\n
\n
def getSourceProjectRelatedValueList():\n
object_path = context.getRelativeUrl()\n
search_path = \'\'.join(["%", object_path,"%"])\n
return_list = []\n
for line in context.portal_catalog(path=search_path ):\n
return_list.extend([ i for i in line.getObject().getSourceProjectRelatedValueList(**kw) if i not in return_list])\n
return return_list\n
\n
if selection is not None:\n
if selection.report_path in [\'project_person_domain\' ]:\n
return context.getSourceProjectRelatedValueList(**kw)\n
\n
if selection.report_path in [\'project_person_task_report_domain\']:\n
if selection.report_path in (\'task_module_domain\', \'project_person_domain\'):\n
kw[\'source_project_relative_url\'] = (context.getRelativeUrl(), \'%s/%%\' % context.getRelativeUrl())\n
elif selection.report_path == \'project_person_task_report_domain\':\n
# It was required filter to one specific portal type\n
kw[\'portal_type\'] = [\'Task Report\']\n
return context.getSourceProjectRelatedValueList(**kw)\n
\n
if selection.report_path in [\'project_projectline_domain\']:\n
return getSourceProjectRelatedValueList()\n
\n
if selection.report_path in [\'project_project_task_report_domain\']:\n
kw[\'source_project_relative_url\'] = (context.getRelativeUrl(), \'%s/%%\' % context.getRelativeUrl())\n
elif selection.report_path == \'project_projectline_domain\':\n
kw[\'source_project_relative_url\'] = (context.getRelativeUrl(), \'%s/%%\' % context.getRelativeUrl())\n
elif selection.report_path in (\'task_report_module_domain\', \'project_project_task_report_domain\'):\n
# It was required filter to one specific portal type\n
kw[\'portal_type\'] = [\'Task Report\']\n
return getSourceProjectRelatedValueList()\n
kw[\'source_project_relative_url\'] = (context.getRelativeUrl(), \'%s/%%\' % context.getRelativeUrl())\n
elif selection.report_path == \'parent\':\n
return context.searchFolder(**kw)\n
else:\n
raise NotImplementedError, "Unknow domain %s" % selection.report_path\n
\n
return context.portal_catalog(**kw)\n
\n
return context.searchFolder(**kw)\n
else:\n
return context.searchFolder(**kw)\n
</string> </value>
</item>
<item>
......@@ -126,10 +121,10 @@ return context.searchFolder(**kw)\n
<string>context</string>
<string>selection_tool</string>
<string>selection</string>
<string>getSourceProjectRelatedValueList</string>
<string>None</string>
<string>_apply_</string>
<string>_write_</string>
<string>_apply_</string>
<string>NotImplementedError</string>
</tuple>
</value>
</item>
......
......@@ -13,10 +13,10 @@
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>title</string>
<string>report_root_list</string>
<string>portal_types</string>
<string>list_method</string>
<string>portal_types</string>
<string>report_root_list</string>
<string>title</string>
</list>
</value>
</item>
......@@ -118,6 +118,14 @@
<key> <string>report_root_list</string> </key>
<value>
<list>
<tuple>
<string>task_module_domain</string>
<string>Task</string>
</tuple>
<tuple>
<string>task_report_module_domain</string>
<string>Task Report</string>
</tuple>
<tuple>
<string>parent</string>
<string>Project Line</string>
......
......@@ -57,29 +57,17 @@
domain_list = []\n
\n
if depth == 0:\n
category_list = [ context.task_module.getObject() ] \n
\n
# XXX this is usefull but Breaks the edition\n
#elif depth == 1:\n
# category_list = context.portal_selections.getSelectionValueList(context=context,\n
# selection_name= \'task_report_selection\')\n
\n
module = context.task_module\n
\n
domain = parent.generateTempDomain(id=\'sub%s\' % module.getId())\n
domain.edit(title=module.getTitle(),\n
membership_criterion_base_category=(\'parent\', ), \n
membership_criterion_category=(module.getRelativeUrl(),),\n
domain_generator_method_id=script.id,\n
uid=module.getUid())\n
return [domain]\n
else:\n
return domain_list\n
\n
for category in category_list:\n
domain = parent.generateTempDomain(id = \'sub\' + category.getId() )\n
domain.edit(title = category.getTitle(),\n
membership_criterion_base_category = (\'parent\', ), \n
membership_criterion_category = (category.getRelativeUrl(),),\n
domain_generator_method_id = script.id,\n
uid = category.getUid())\n
\n
domain_list.append(domain)\n
#from Products.ERP5Type.Log import log\n
#log("%s on %s" % (script.getId(), context.getPath()), "%d objects domain" % len(domain_list))\n
return domain_list\n
return []\n
</string> </value>
</item>
<item>
......@@ -123,9 +111,7 @@ return domain_list\n
<string>context</string>
<string>request</string>
<string>domain_list</string>
<string>category_list</string>
<string>_getiter_</string>
<string>category</string>
<string>module</string>
<string>domain</string>
<string>script</string>
</tuple>
......
712
\ No newline at end of file
717
\ No newline at end of file
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