Commit 35807a47 authored by Jérome Perrin's avatar Jérome Perrin

PDM: fix jump from resources to transformations

It was not enabled in ERP5JS had minor issues

See merge request !1473
parents 4319e328 61f767b0
......@@ -73,11 +73,7 @@
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string encoding="cdata"><![CDATA[
string:${object_url}/Base_jumpToRelatedObject?base_category=resource&portal_type=Transformation
]]></string> </value>
<value> <string>string:${object_url}/Resource_jumpToRelatedTransformation</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -16,13 +16,13 @@
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/object_jump</string>
<string>action_type/object_jio_jump</string>
</tuple>
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_jump</string> </value>
<value> <string>object_jio_jump</string> </value>
</item>
<item>
<key> <string>condition</string> </key>
......@@ -30,7 +30,9 @@
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
<value>
<none/>
</value>
</item>
<item>
<key> <string>icon</string> </key>
......
......@@ -33,6 +33,15 @@ else:
transformation_uid_list.append(uid)
module = portal.getDefaultModule('Transformation')
message = 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=translateString('Documents related to ${that_portal_type} : ${that_title}.',
mapping={"that_portal_type": context.getTranslatedPortalType(),
"that_title": context.getTitleOrId() }),)
return module.Base_redirect('view',
keep_items=dict(reset=1,
portal_status_message=message,
ignore_hide_rows=1,
uid=transformation_uid_list))
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
</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>
<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>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>testResourceJumpToTransformation</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>utf-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <unicode>Resource Jump to Transformation</unicode> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<html>
<head><title tal:content="template/title"></title></head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="4" tal:content="template/title"></td></tr>
</thead>
<tbody tal:define="init_method string:ERP5Site_createTransformationForPdmUiTest; open_stock_browser python:False">
<!-- Setup {{{ -->
<tal:block metal:use-macro="here/PdmZuite_CommonTemplateForRenderjsUi/macros/init" />
<tal:block tal:repeat="resource_relative_url python: (
'product_module/erp5_pdm_ui_test_product_without_transformation',
'component_module/erp5_pdm_ui_test_component_without_transformation',)">
<tr>
<td>open</td>
<td>${base_url}/web_site_module/renderjs_runner/#/<tal:block tal:replace="resource_relative_url"/></td>
<td></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_app_loaded" />
<tal:block tal:define="click_configuration python: {'text': 'Views'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/click_on_header_link" />
</tal:block>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tal:block tal:define="click_configuration python: {'text': 'Related Transformation'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/click_on_page_link" />
</tal:block>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tal:block tal:define="notification_configuration python: {'class': 'success',
'text': 'No Transformation related.'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_notification" />
</tal:block>
<tr>
<td>open</td>
<td>${base_url}/Zuite_waitForActivities</td>
<td></td>
</tr>
<tr>
<td>assertTextPresent</td>
<td>Done.</td>
<td></td>
</tr>
</tal:block>
<tr>
<td>open</td>
<td>${base_url}/web_site_module/renderjs_runner/#/product_module/erp5_pdm_ui_test_product_with_one_transformation</td>
<td></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_app_loaded" />
<tal:block tal:define="click_configuration python: {'text': 'Views'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/click_on_header_link" />
</tal:block>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tal:block tal:define="click_configuration python: {'text': 'Related Transformation'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/click_on_page_link" />
</tal:block>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tal:block tal:define="notification_configuration python: {'class': 'success',
'text': 'Transformation related to Product : erp5_pdm_ui_test_product_with_one_transformation.'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_notification" />
</tal:block>
<tr>
<td>open</td>
<td>${base_url}/Zuite_waitForActivities</td>
<td></td>
</tr>
<tr>
<td>assertTextPresent</td>
<td>Done.</td>
<td></td>
</tr>
<tr>
<td>open</td>
<td>${base_url}/web_site_module/renderjs_runner/#/component_module/erp5_pdm_ui_test_component_with_one_transformation</td>
<td></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_app_loaded" />
<tal:block tal:define="click_configuration python: {'text': 'Views'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/click_on_header_link" />
</tal:block>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tal:block tal:define="click_configuration python: {'text': 'Related Transformation'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/click_on_page_link" />
</tal:block>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tal:block tal:define="notification_configuration python: {'class': 'success',
'text': 'Transformation related to Component : erp5_pdm_ui_test_component_with_one_transformation.'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_notification" />
</tal:block>
<!-- XXX we don't really need to wait for activities, but this is needed to use `open` later -->
<tr>
<td>open</td>
<td>${base_url}/Zuite_waitForActivities</td>
<td></td>
</tr>
<tr>
<td>assertTextPresent</td>
<td>Done.</td>
<td></td>
</tr>
<tr>
<td>open</td>
<td>${base_url}/web_site_module/renderjs_runner/#/product_module/erp5_pdm_ui_test_product_with_two_transformations</td>
<td></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_app_loaded" />
<tal:block tal:define="click_configuration python: {'text': 'Views'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/click_on_header_link" />
</tal:block>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tal:block tal:define="click_configuration python: {'text': 'Related Transformation'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/click_on_page_link" />
</tal:block>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_listbox_loaded" />
<tal:block tal:define="notification_configuration python: {'class': 'success',
'text': 'Documents related to Product : erp5_pdm_ui_test_product_with_two_transformations.'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_notification" />
</tal:block>
<tal:block tal:define="pagination_configuration python: {'header': '(2)', 'footer': '2 Records'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/check_listbox_pagination_text" />
</tal:block>
<tr>
<td>assertTextPresent</td>
<td>erp5_pdm_ui_test_transformation_1</td>
<td></td>
</tr>
<tr>
<td>open</td>
<td>${base_url}/Zuite_waitForActivities</td>
<td></td>
</tr>
<tr>
<td>assertTextPresent</td>
<td>Done.</td>
<td></td>
</tr>
<tr>
<td>open</td>
<td>${base_url}/web_site_module/renderjs_runner/#/component_module/erp5_pdm_ui_test_component_with_two_transformations</td>
<td></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_app_loaded" />
<tal:block tal:define="click_configuration python: {'text': 'Views'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/click_on_header_link" />
</tal:block>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tal:block tal:define="click_configuration python: {'text': 'Related Transformation'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/click_on_page_link" />
</tal:block>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_listbox_loaded" />
<tal:block tal:define="notification_configuration python: {'class': 'success',
'text': 'Documents related to Component : erp5_pdm_ui_test_component_with_two_transformations.'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_notification" />
</tal:block>
<tal:block tal:define="pagination_configuration python: {'header': '(2)', 'footer': '2 Records'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/check_listbox_pagination_text" />
</tal:block>
<tr>
<td>assertTextPresent</td>
<td>erp5_pdm_ui_test_transformation_1</td>
<td></td>
</tr>
<tr>
<td>open</td>
<td>${base_url}/Zuite_waitForActivities</td>
<td></td>
</tr>
<tr>
<td>assertTextPresent</td>
<td>Done.</td>
<td></td>
</tr>
</tbody></table>
</body>
</html>
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
</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>
<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>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>testResourceJumpToTransformation</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>utf-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <unicode>Resource Jump to Transformation</unicode> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<html>
<head><title tal:content="template/title"></title></head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="4" tal:content="template/title"></td></tr>
</thead>
<tbody tal:define="init_method string:ERP5Site_createTransformationForPdmUiTest">
<tal:block metal:use-macro="here/PdmZuite_CommonTemplate/macros/init" />
<tal:block tal:repeat="resource_relative_url python: (
'product_module/erp5_pdm_ui_test_product_without_transformation',
'component_module/erp5_pdm_ui_test_component_without_transformation',)">
<tr>
<td>open</td>
<td>${base_url}/<tal:block tal:replace="resource_relative_url"/></td>
<td></td>
</tr>
<tr>
<td>selectAndWait</td>
<td>select_jump</td>
<td>Related Transformation</td>
</tr>
<tr>
<td>assertPortalStatusMessage</td>
<td>No Transformation related.</td>
<td></td>
</tr>
</tal:block>
<tr>
<td>open</td>
<td>${base_url}/product_module/erp5_pdm_ui_test_product_with_one_transformation</td>
<td></td>
</tr>
<tr>
<td>selectAndWait</td>
<td>select_jump</td>
<td>Related Transformation</td>
</tr>
<tr>
<td>assertPortalStatusMessage</td>
<td>Transformation related to Product : erp5_pdm_ui_test_product_with_one_transformation.</td>
<td></td>
</tr>
<tr>
<td>open</td>
<td>${base_url}/component_module/erp5_pdm_ui_test_component_with_one_transformation</td>
<td></td>
</tr>
<tr>
<td>selectAndWait</td>
<td>select_jump</td>
<td>Related Transformation</td>
</tr>
<tr>
<td>assertPortalStatusMessage</td>
<td>Transformation related to Component : erp5_pdm_ui_test_component_with_one_transformation.</td>
<td></td>
</tr>
<tr>
<td>open</td>
<td>${base_url}/product_module/erp5_pdm_ui_test_product_with_two_transformations</td>
<td></td>
</tr>
<tr>
<td>selectAndWait</td>
<td>select_jump</td>
<td>Related Transformation</td>
</tr>
<tr>
<td>assertPortalStatusMessage</td>
<td>Documents related to Product : erp5_pdm_ui_test_product_with_two_transformations.</td>
<td></td>
</tr>
<tr>
<td>assertText</td>
<td>//span[@class="listbox-current-page-total-number"]</td>
<td>2 records</td>
</tr>
<tr>
<td>assertTextPresent</td>
<td>erp5_pdm_ui_test_transformation_1</td>
<td></td>
</tr>
<tr>
<td>open</td>
<td>${base_url}/component_module/erp5_pdm_ui_test_component_with_two_transformations</td>
<td></td>
</tr>
<tr>
<td>selectAndWait</td>
<td>select_jump</td>
<td>Related Transformation</td>
</tr>
<tr>
<td>assertPortalStatusMessage</td>
<td>Documents related to Component : erp5_pdm_ui_test_component_with_two_transformations.</td>
<td></td>
</tr>
<tr>
<td>assertText</td>
<td>//span[@class="listbox-current-page-total-number"]</td>
<td>2 records</td>
</tr>
<tr>
<td>assertTextPresent</td>
<td>erp5_pdm_ui_test_transformation_1</td>
<td></td>
</tr>
</tbody></table>
</body>
</html>
\ No newline at end of file
portal = context.getPortalObject()
# Create resources and transformations.
for product_id in (
'erp5_pdm_ui_test_product_with_one_transformation',
'erp5_pdm_ui_test_product_with_two_transformations',
'erp5_pdm_ui_test_product_without_transformation',
):
if getattr(portal.product_module, product_id, None) is None:
portal.product_module.newContent(id=product_id, portal_type='Product')
for component_id in (
'erp5_pdm_ui_test_component_with_one_transformation',
'erp5_pdm_ui_test_component_with_two_transformations',
'erp5_pdm_ui_test_component_without_transformation',
):
if getattr(portal.component_module, component_id, None) is None:
portal.component_module.newContent(id=component_id, portal_type='Component')
erp5_pdm_ui_test_transformation_1 = portal.transformation_module.newContent(
portal_type='Transformation',
id='erp5_pdm_ui_test_transformation_1',
resource_value=portal.product_module.erp5_pdm_ui_test_product_with_two_transformations,
)
erp5_pdm_ui_test_transformation_1.newContent(
portal_type='Transformation Transformed Resource',
resource_value=portal.product_module.erp5_pdm_ui_test_product_with_one_transformation,
)
erp5_pdm_ui_test_transformation_1.newContent(
portal_type='Transformation Transformed Resource',
resource_value=portal.component_module.erp5_pdm_ui_test_component_with_one_transformation,
)
erp5_pdm_ui_test_transformation_1.newContent(
portal_type='Transformation Transformed Resource',
resource_value=portal.component_module.erp5_pdm_ui_test_component_with_two_transformations,
)
erp5_pdm_ui_test_transformation_2 = portal.transformation_module.newContent(
portal_type='Transformation',
id='erp5_pdm_ui_test_transformation_2',
resource_value=portal.component_module.erp5_pdm_ui_test_component_with_two_transformations,
)
erp5_pdm_ui_test_transformation_2.newContent(
portal_type='Transformation Transformed Resource',
resource_value=portal.product_module.erp5_pdm_ui_test_product_with_two_transformations,
)
portal.transformation_module.newContent(
portal_type='Transformation',
id='erp5_pdm_ui_test_transformation_3',
)
return "Delivery Created."
<?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></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5Site_createTransformationForPdmUiTest</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -10,10 +10,20 @@ destination_site_id = "erp5_pdm_ui_test_destination_site"
delivery_id = "erp5_pdm_ui_test_delivery"
# Delete resources
if getattr(portal.product_module, 'erp5_pdm_ui_test_product', None) is not None:
portal.product_module.manage_delObjects(['erp5_pdm_ui_test_product'])
if getattr(portal.component_module, 'erp5_pdm_ui_test_component', None) is not None:
portal.component_module.manage_delObjects(['erp5_pdm_ui_test_component'])
for product_id in (
'erp5_pdm_ui_test_product',
'erp5_pdm_ui_test_product_with_two_transformations',
'erp5_pdm_ui_test_product_without_transformation',
):
if getattr(portal.product_module, product_id, None) is not None:
portal.product_module.manage_delObjects([product_id])
for component_id in (
'erp5_pdm_ui_test_component',
'erp5_pdm_ui_test_component_with_two_transformations',
'erp5_pdm_ui_test_component_without_transformation',
):
if getattr(portal.component_module, component_id, None) is not None:
portal.component_module.manage_delObjects([component_id])
# Delete nodes
module = portal.getDefaultModule(node_portal_type)
......@@ -53,4 +63,13 @@ for supply_portal_type in ('Purchase Supply', 'Sale Supply', 'Internal Supply',
if getattr(module, supply_id, None) is not None:
module.manage_delObjects([supply_id])
for transformation_id in (
'erp5_pdm_ui_test_transformation_1',
'erp5_pdm_ui_test_transformation_2',
'erp5_pdm_ui_test_transformation_3',
):
if getattr(portal.transformation_module, transformation_id, None) is not None:
portal.transformation_module.manage_delObjects([transformation_id])
return "Deleted Successfully."
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