Commit cbefdfab authored by Jérome Perrin's avatar Jérome Perrin

Base_jumpToRelatedObject: also redirect to the module in related=0 mode.

Add missing reset=1 when redirecting to a module.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@22753 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent f5fbed57
......@@ -70,12 +70,11 @@ N_ = context.Base_translateString\n
checkPerm = context.portal_membership.checkPermission\n
\n
# FIXME: performance problem getting *all* related documents URL is not scalable.\n
getter_base_name = \'\'.join([x.capitalize() for x in base_category.split(\'_\')])\n
if related:\n
search_method = getattr(context, \'get%sRelatedList\' %\n
string.join([string.capitalize(x) for x in base_category.split(\'_\')], \'\'))\n
search_method = getattr(context, \'get%sRelatedList\' % getter_base_name)\n
else:\n
search_method = getattr(context, \'get%sList\' %\n
string.join([string.capitalize(x) for x in base_category.split(\'_\')], \'\'))\n
search_method = getattr(context, \'get%sList\' % getter_base_name)\n
\n
related_list = search_method(portal_type = portal_type)\n
\n
......@@ -114,11 +113,19 @@ elif len(related_list) == 1:\n
\n
else:\n
# jump to the module if we can guess it\n
if related and len(portal_type) == 1:\n
if len(portal_type) == 1:\n
module_id = context.getPortalObject().getDefaultModuleId(portal_type[0], None)\n
if module_id is not None:\n
if related:\n
return context.getPortalObject().getDefaultModule(portal_type[0]).Base_redirect(\n
\'view\', keep_items={\'%s_uid\' % base_category: context.getUid(),\n
\'reset\': 1})\n
get_uid_method = getattr(context, \'get%sUidList\' % getter_base_name)\n
return context.getPortalObject().getDefaultModule(portal_type[0]).Base_redirect(\n
\'view\', keep_items={\'%s_uid\' % base_category: context.getUid(), })\n
\'view\', keep_items=dict(\n
reset=1,\n
uid=get_uid_method(portal_type=portal_type,\n
checked_permission=\'View\')))\n
\n
# compute the list of objects we are actually authorized to view\n
related_object_list = []\n
......@@ -170,6 +177,12 @@ return context.REQUEST[ \'RESPONSE\' ].redirect(redirect_url)\n
<none/>
</value>
</item>
<item>
<key> <string>_owner</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>base_category, portal_type=(), related=1, selection_name="", selection_index=0, form_id=\'view\'</string> </value>
......@@ -210,12 +223,12 @@ return context.REQUEST[ \'RESPONSE\' ].redirect(redirect_url)\n
<string>context</string>
<string>N_</string>
<string>checkPerm</string>
<string>getattr</string>
<string>string</string>
<string>append</string>
<string>$append0</string>
<string>_getiter_</string>
<string>x</string>
<string>getter_base_name</string>
<string>getattr</string>
<string>search_method</string>
<string>related_list</string>
<string>same_type</string>
......@@ -228,13 +241,14 @@ return context.REQUEST[ \'RESPONSE\' ].redirect(redirect_url)\n
<string>None</string>
<string>related_object</string>
<string>module_id</string>
<string>get_uid_method</string>
<string>dict</string>
<string>related_object_list</string>
<string>path</string>
<string>obj</string>
<string>request</string>
<string>selection_uid_list</string>
<string>kw</string>
<string>dict</string>
<string>query_params</string>
<string>_write_</string>
<string>redirect_url</string>
......
925
\ No newline at end of file
926
\ 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