Commit fe49fd05 authored by Romain Courteaud's avatar Romain Courteaud

[erp5_hal_json_style] Ensure action URL parameters are can be used as default field value

parent ec6473c5
...@@ -41,7 +41,7 @@ Copy of unittest <a href="https://lab.nexedi.com/nexedi/erp5/blob/master/product ...@@ -41,7 +41,7 @@ Copy of unittest <a href="https://lab.nexedi.com/nexedi/erp5/blob/master/product
<tr><td>assertElementPresent</td> <tr><td>assertElementPresent</td>
<td>//a[@data-i18n="Account Statement"]</td><td></td></tr> <td>//a[@data-i18n="Account Statement"]</td><td></td></tr>
<tr><td>click</td> <tr><td>click</td>
<td>//a[@data-i18n="Account Statement"]</td><td></td></tr> <td>//a[@data-i18n="Account Statement" and contains(@href, 'account_statement_report')]</td><td></td></tr>
<tr><td>waitForElementPresent</td> <tr><td>waitForElementPresent</td>
<td>//div[@data-gadget-scope="field_your_node"]/div/div[1]//select</td><td></td></tr> <td>//div[@data-gadget-scope="field_your_node"]/div/div[1]//select</td><td></td></tr>
......
...@@ -36,7 +36,7 @@ Copy of unittest <a href="https://lab.nexedi.com/nexedi/erp5/blob/master/product ...@@ -36,7 +36,7 @@ Copy of unittest <a href="https://lab.nexedi.com/nexedi/erp5/blob/master/product
<tr><td>waitForElementPresent</td> <tr><td>waitForElementPresent</td>
<td>//a[@data-i18n="Aged Balance"]</td><td></td></tr> <td>//a[@data-i18n="Aged Balance"]</td><td></td></tr>
<tr><td>click</td> <tr><td>click</td>
<td>//a[@data-i18n="Aged Balance"]</td><td></td></tr> <td>//a[@data-i18n="Aged Balance" and contains(@href, 'aged_balance_report')]</td><td></td></tr>
<tr><td>waitForElementPresent</td> <tr><td>waitForElementPresent</td>
<td>//select[@name="field_your_section_category"]</td><td></td></tr> <td>//select[@name="field_your_section_category"]</td><td></td></tr>
......
...@@ -33,7 +33,7 @@ Copy of unittest <a href="https://lab.nexedi.com/nexedi/erp5/blob/master/product ...@@ -33,7 +33,7 @@ Copy of unittest <a href="https://lab.nexedi.com/nexedi/erp5/blob/master/product
<tr><td>waitForElementPresent</td> <tr><td>waitForElementPresent</td>
<td>//a[@data-i18n="Balance Sheet"]</td><td></td></tr> <td>//a[@data-i18n="Balance Sheet"]</td><td></td></tr>
<tr><td>click</td> <tr><td>click</td>
<td>//a[@data-i18n="Balance Sheet"]</td><td></td></tr> <td>//a[@data-i18n="Balance Sheet" and contains(@href, 'balance_sheet_report')]</td><td></td></tr>
<tr><td>waitForElementPresent</td> <tr><td>waitForElementPresent</td>
<td>//select[@name="field_your_section_category"]</td><td></td></tr> <td>//select[@name="field_your_section_category"]</td><td></td></tr>
......
...@@ -42,7 +42,7 @@ Copy of unittest <a href="https://lab.nexedi.com/nexedi/erp5/blob/master/product ...@@ -42,7 +42,7 @@ Copy of unittest <a href="https://lab.nexedi.com/nexedi/erp5/blob/master/product
<tr><td>waitForElementPresent</td> <tr><td>waitForElementPresent</td>
<td>//a[@data-i18n="General Ledger"]</td><td></td></tr> <td>//a[@data-i18n="General Ledger"]</td><td></td></tr>
<tr><td>click</td> <tr><td>click</td>
<td>//a[@data-i18n="General Ledger"]</td><td></td></tr> <td>//a[@data-i18n="General Ledger" and contains(@href, 'general_ledger_report')]</td><td></td></tr>
<tr><td>waitForElementPresent</td><td>//input[@name="field_your_from_date"]</td><td></td></tr> <tr><td>waitForElementPresent</td><td>//input[@name="field_your_from_date"]</td><td></td></tr>
<tr><td>type</td> <tr><td>type</td>
......
...@@ -28,7 +28,7 @@ Copy of <a href="https://lab.nexedi.com/nexedi/erp5/blob/master/product/ERP5/tes ...@@ -28,7 +28,7 @@ Copy of <a href="https://lab.nexedi.com/nexedi/erp5/blob/master/product/ERP5/tes
<tr><td>waitForElementPresent</td> <tr><td>waitForElementPresent</td>
<td>//a[@data-i18n="Journal"]</td><td></td></tr> <td>//a[@data-i18n="Journal"]</td><td></td></tr>
<tr><td>click</td> <tr><td>click</td>
<td>//a[@data-i18n="Journal"]</td><td></td></tr> <td>//a[@data-i18n="Journal" and contains(@href, 'journal_report')]</td><td></td></tr>
<tr><td>waitForElementPresent</td> <tr><td>waitForElementPresent</td>
<td>//select[@name="field_your_section_category"]</td><td></td></tr> <td>//select[@name="field_your_section_category"]</td><td></td></tr>
......
...@@ -33,7 +33,7 @@ Copy of unittest <a href="https://lab.nexedi.com/nexedi/erp5/blob/master/product ...@@ -33,7 +33,7 @@ Copy of unittest <a href="https://lab.nexedi.com/nexedi/erp5/blob/master/product
<tr><td>waitForElementPresent</td> <tr><td>waitForElementPresent</td>
<td>//a[@data-i18n="Profit and Loss"]</td><td></td></tr> <td>//a[@data-i18n="Profit and Loss"]</td><td></td></tr>
<tr><td>click</td> <tr><td>click</td>
<td>//a[@data-i18n="Profit and Loss"]</td><td></td></tr> <td>//a[@data-i18n="Profit and Loss" and contains(@href, 'profit_and_loss_report')]</td><td></td></tr>
<tr><td>waitForElementPresent</td> <tr><td>waitForElementPresent</td>
<td>//select[@name="field_your_section_category"]</td><td></td></tr> <td>//select[@name="field_your_section_category"]</td><td></td></tr>
......
...@@ -28,7 +28,7 @@ Check that use gets notified if they are using wrong 'Report Style' (UI) Prefere ...@@ -28,7 +28,7 @@ Check that use gets notified if they are using wrong 'Report Style' (UI) Prefere
<tr><td>waitForElementPresent</td> <tr><td>waitForElementPresent</td>
<td>//a[@data-i18n="Journal"]</td><td></td></tr> <td>//a[@data-i18n="Journal"]</td><td></td></tr>
<tr><td>click</td> <tr><td>click</td>
<td>//a[@data-i18n="Journal"]</td><td></td></tr> <td>//a[@data-i18n="Journal" and contains(@href, 'journal_report')]</td><td></td></tr>
<tr><td>waitForElementPresent</td> <tr><td>waitForElementPresent</td>
<td>//select[@name="field_your_section_category"]</td><td></td></tr> <td>//select[@name="field_your_section_category"]</td><td></td></tr>
<tr><td>select</td> <tr><td>select</td>
......
...@@ -38,7 +38,7 @@ Copy of unittest <a href="https://lab.nexedi.com/nexedi/erp5/blob/master/product ...@@ -38,7 +38,7 @@ Copy of unittest <a href="https://lab.nexedi.com/nexedi/erp5/blob/master/product
<tr><td>waitForElementPresent</td> <tr><td>waitForElementPresent</td>
<td>//a[@data-i18n="Third Parties"]</td><td></td></tr> <td>//a[@data-i18n="Third Parties"]</td><td></td></tr>
<tr><td>click</td> <tr><td>click</td>
<td>//a[@data-i18n="Third Parties"]</td><td></td></tr> <td>//a[@data-i18n="Third Parties" and contains(@href, 'third_parties_report')]</td><td></td></tr>
<tr><td>waitForElementPresent</td> <tr><td>waitForElementPresent</td>
<td>//select[@name="field_your_section_category"]</td><td></td></tr> <td>//select[@name="field_your_section_category"]</td><td></td></tr>
......
...@@ -28,7 +28,7 @@ Copy of unittest <a href="https://lab.nexedi.com/nexedi/erp5/blob/master/product ...@@ -28,7 +28,7 @@ Copy of unittest <a href="https://lab.nexedi.com/nexedi/erp5/blob/master/product
<tr><td>waitForElementPresent</td> <tr><td>waitForElementPresent</td>
<td>//a[@data-i18n="Trial Balance"]</td><td></td></tr> <td>//a[@data-i18n="Trial Balance"]</td><td></td></tr>
<tr><td>click</td> <tr><td>click</td>
<td>//a[@data-i18n="Trial Balance"]</td><td></td></tr> <td>//a[@data-i18n="Trial Balance" and contains(@href, 'trial_balance_report')]</td><td></td></tr>
<tr><td>store</td><td tal:content="python: '{:0>#2d}'.format(now.day())"></td><td>day</td></tr> <tr><td>store</td><td tal:content="python: '{:0>#2d}'.format(now.day())"></td><td>day</td></tr>
<tr><td>store</td><td tal:content="python: '{:0>#2d}'.format(now.month())"></td><td>month</td></tr> <tr><td>store</td><td tal:content="python: '{:0>#2d}'.format(now.month())"></td><td>month</td></tr>
......
...@@ -1353,6 +1353,7 @@ def calculateHateoas(is_portal=None, is_site_root=None, traversed_document=None, ...@@ -1353,6 +1353,7 @@ def calculateHateoas(is_portal=None, is_site_root=None, traversed_document=None,
# Request is later used for method's arguments discovery so set URL params into REQUEST (just like it was sent by form) # Request is later used for method's arguments discovery so set URL params into REQUEST (just like it was sent by form)
for query_key, query_value in byteify(current_action['params'].items()): for query_key, query_value in byteify(current_action['params'].items()):
REQUEST.set(query_key, query_value) REQUEST.set(query_key, query_value)
REQUEST.form[query_key] = query_value
# If our "form" is actually a Script (nothing is sure in ERP5) or anything else than Form # If our "form" is actually a Script (nothing is sure in ERP5) or anything else than Form
# (e.g. function or bound class method will) not have .meta_type thus be considered a Script # (e.g. function or bound class method will) not have .meta_type thus be considered a Script
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ActionInformation" module="Products.CMFCore.ActionInformation"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>action</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/object_jio_action</string>
</tuple>
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_jio_action</string> </value>
</item>
<item>
<key> <string>condition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string>A simple dialog with some standard fields</string> </value>
</item>
<item>
<key> <string>icon</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>view_url_parameter_dialog</string> </value>
</item>
<item>
<key> <string>permissions</string> </key>
<value>
<tuple>
<string>View</string>
</tuple>
</value>
</item>
<item>
<key> <string>priority</string> </key>
<value> <float>7.0</float> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Check Url Parameter Dialog</string> </value>
</item>
<item>
<key> <string>visible</string> </key>
<value> <int>1</int> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Expression" module="Products.CMFCore.Expression"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string encoding="cdata"><![CDATA[
string:${object_url}/Foo_viewFormBoxDialog?my_id=foo&my_title=bar
]]></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -45,3 +45,4 @@ Foo | view_print_dialog ...@@ -45,3 +45,4 @@ Foo | view_print_dialog
Foo | view_printout_form Foo | view_printout_form
Foo | view_proxy_field Foo | view_proxy_field
Foo | view_relation_field Foo | view_relation_field
Foo | view_url_parameter_dialog
\ 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>testActionUrlParameter</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></unicode> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<html xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Test Command Display With History</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">Test Command Display With History</td></tr>
</thead><tbody>
<tal:block metal:use-macro="here/PTZuite_CommonTemplate/macros/init" />
<tr>
<td>open</td>
<td>${base_url}/web_site_module/renderjs_runner/#/foo_module/1</td>
<td></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_app_loaded" />
<!-- Wait for gadget to be loaded -->
<tr>
<td>assertElementPresent</td>
<td>//div[@data-gadget-url='${base_url}/web_site_module/renderjs_runner/gadget_erp5_pt_form_view.html']</td>
<td></td>
</tr>
<!-- Trigger the dialog display on the panel link -->
<tr>
<td>assertElementPresent</td>
<td>//div[@data-gadget-scope='panel']//a[text()='Check Url Parameter Dialog']</td>
<td></td>
</tr>
<tal:block tal:define="click_configuration python: {'text': 'Check Url Parameter Dialog'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/click_on_panel_link" />
</tal:block>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tr>
<td>assertValue</td>
<td>field_my_id</td>
<td>foo</td>
</tr>
<tr>
<td>assertValue</td>
<td>field_my_formbox_my_title</td>
<td>bar</td>
</tr>
</tbody></table>
</body>
</html>
\ 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