Commit 8901c60a authored by Romain Courteaud's avatar Romain Courteaud

erp5_core: jump to document script

parent 18232a01
portal = context.getPortalObject()
Base_translateString = portal.Base_translateString
redirect_context = context
catalog_list = context.Base_getRelatedDocumentList(limit=2)
if len(catalog_list) == 0:
message = Base_translateString('No Document Related')
elif len(catalog_list) == 1:
redirect_context = catalog_list[0].getObject()
if target_form_id is not None:
form_id = target_form_id
message = Base_translateString(
# first, try to get a full translated message with portal types
"%s related to %s." % (redirect_context.getPortalType(), context.getPortalType()),
# if not found, fallback to generic translation
default=Base_translateString('${this_portal_type} related to ${that_portal_type} : ${that_title}.',
mapping={"this_portal_type": redirect_context.getTranslatedPortalType(),
"that_portal_type": context.getTranslatedPortalType(),
"that_title": context.getTitleOrId() }),)
else:
form_id = relation_form_id
message = Base_translateString(
# first, try to get a full translated message with portal types
"Documents related to %s." % context.getPortalType(),
# if not found, fallback to generic translation
default=Base_translateString('Documents related to ${that_portal_type} : ${that_title}.',
mapping={"that_portal_type": context.getTranslatedPortalType(),
"that_title": context.getTitleOrId() }),)
query_params = dict(portal_status_message=message)
return redirect_context.Base_redirect(
form_id, keep_items=query_params)
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </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>_params</string> </key>
<value> <string>form_id=\'view\', target_form_id=None, relation_form_id=\'Base_viewDocumentSearchableList\'</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Base_jumpToRelatedDocumentList</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
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