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

pdm: allow to select node category in stock browser dialog

This allows to filter the node by site in new and old interface in
a consistent way.

The domain tree is also removed for consistency (so that we don't have
different features on new and old interface)

Old UI tests have also been updated to use more meaningful macro names.
parent bc465dd5
......@@ -229,6 +229,7 @@
<string>my_base_price_per_slice</string>
<string>my_report_mode_listbox_variation_category_item_list</string>
<string>my_view_mode_read_only_title</string>
<string>my_dialog_mode_node_category</string>
</list>
</value>
</item>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>items</string>
<string>required</string>
<string>title</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>my_dialog_mode_node_category</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>items</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>required</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_list_field</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>items</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>required</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Site</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: getattr(here.portal_categories.site, preferences.getPreference(\'preferred_category_child_item_list_method_id\', \'getCategoryChildCompactLogicalPathItemList\'))(local_sort_id=(\'int_index\', \'translated_title\'), checked_permission=\'View\', base=True)</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
from Products.PythonScripts.standard import Object
portal = context.getPortalObject()
inventory_kw = {
'selection_domain': selection_domain,
'group_by_section': False,
'group_by_node': True,
'group_by_variation': True,
'resource_uid': context.getUid(),
}
if node_category:
inventory_kw['node_category'] = node_category
return portal.portal_simulation.getFutureInventoryList(**inventory_kw)
<?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>node_category=None, selection_domain=None, **kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Resource_getFutureInventoryList</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
from Products.PythonScripts.standard import Object
inventory_kw = {
'selection_domain': selection_domain
}
if node_category:
inventory_kw['node_category'] = node_category
obj = Object(uid="new_")
obj["node_title"] = ""
obj["section_title"] = ""
obj["variation_text"] = ""
obj["getCurrentInventory"] = context.getCurrentInventory(selection_domain=kw.get('selection_domain', None))
obj["getAvailableInventory"] = context.getAvailableInventory(selection_domain=kw.get('selection_domain', None))
obj["inventory"] = context.getFutureInventory(selection_domain=kw.get('selection_domain', None))
obj["getCurrentInventory"] = context.getCurrentInventory(**inventory_kw)
obj["getAvailableInventory"] = context.getAvailableInventory(**inventory_kw)
obj["inventory"] = context.getFutureInventory(**inventory_kw)
return [obj,]
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>**kw</string> </value>
<value> <string>node_category=None, selection_domain=None, **kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
......@@ -86,9 +86,7 @@
<item>
<key> <string>center</string> </key>
<value>
<list>
<string>my_title</string>
</list>
<list/>
</value>
</item>
<item>
......@@ -105,7 +103,10 @@
<item>
<key> <string>left</string> </key>
<value>
<list/>
<list>
<string>my_title</string>
<string>your_node_category</string>
</list>
</value>
</item>
<item>
......
......@@ -351,9 +351,7 @@
</item>
<item>
<key> <string>count_method</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
......@@ -386,17 +384,12 @@
<item>
<key> <string>domain_root_list</string> </key>
<value>
<list>
<tuple>
<string>site</string>
<string>Site</string>
</tuple>
</list>
<list/>
</value>
</item>
<item>
<key> <string>domain_tree</string> </key>
<value> <int>1</int> </value>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>editable</string> </key>
......@@ -462,7 +455,7 @@
<item>
<key> <string>list_method</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
......@@ -538,7 +531,7 @@
<item>
<key> <string>stat_method</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAU=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
<item>
......@@ -571,13 +564,7 @@
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<tuple>
<tuple>
<string>Products.Formulator.TALESField</string>
<string>TALESMethod</string>
</tuple>
<none/>
</tuple>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
......@@ -596,25 +583,12 @@
<dictionary>
<item>
<key> <string>method_name</string> </key>
<value> <string>getFutureInventoryCount</string> </value>
<value> <string>Resource_getFutureInventoryList</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="Method" module="Products.Formulator.MethodField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>method_name</string> </key>
<value> <string>getFutureInventoryList</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="5" aka="AAAAAAAAAAU=">
<pickle>
<global name="Method" module="Products.Formulator.MethodField"/>
</pickle>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>default</string>
<string>required</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>your_node_category</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>default</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_dialog_mode_node_category</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewPDMFieldLibrary</string> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>preferences/getPreferredNodeCategory</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -14,23 +14,23 @@ Test stock browser for confirmed state
<!-- }}} -->
<!-- Check source -->
<tal:block tal:define="link_title python: 'erp5_pdm_ui_test_source_site';
<tal:block tal:define="node_category python: 'erp5_pdm_ui_test_source_site_title';
movement_count python: 1;
current_inventory python: 0.0;
available_inventory python: -1.0;
future_inventory python: -1.0;
">
<tal:block metal:use-macro="here/PdmZuite_checkStockBrowser/macros/init" />
<tal:block metal:use-macro="here/PdmZuite_checkStockBrowser/macros/check_inventory" />
</tal:block>
<!-- Check destination -->
<tal:block tal:define="link_title python: 'erp5_pdm_ui_test_destination_site';
<tal:block tal:define="node_category python: 'erp5_pdm_ui_test_destination_site_title';
movement_count python: 1;
current_inventory python: 0.0;
available_inventory python: 0.0;
future_inventory python: 1.0;
">
<tal:block metal:use-macro="here/PdmZuite_checkStockBrowser/macros/init" />
<tal:block metal:use-macro="here/PdmZuite_checkStockBrowser/macros/check_inventory" />
</tal:block>
</tbody></table>
......
......@@ -14,23 +14,23 @@ Test stock browser for delivered state
<!-- }}} -->
<!-- Check source -->
<tal:block tal:define="link_title python: 'erp5_pdm_ui_test_source_site';
<tal:block tal:define="node_category python: 'erp5_pdm_ui_test_source_site_title';
movement_count python: 1;
current_inventory python: -1.0;
available_inventory python: -1.0;
future_inventory python: -1.0;
">
<tal:block metal:use-macro="here/PdmZuite_checkStockBrowser/macros/init" />
<tal:block metal:use-macro="here/PdmZuite_checkStockBrowser/macros/check_inventory" />
</tal:block>
<!-- Check destination -->
<tal:block tal:define="link_title python: 'erp5_pdm_ui_test_destination_site';
<tal:block tal:define="node_category python: 'erp5_pdm_ui_test_destination_site_title';
movement_count python: 1;
current_inventory python: 1.0;
available_inventory python: 1.0;
future_inventory python: 1.0;
">
<tal:block metal:use-macro="here/PdmZuite_checkStockBrowser/macros/init" />
<tal:block metal:use-macro="here/PdmZuite_checkStockBrowser/macros/check_inventory" />
</tal:block>
</tbody></table>
......
......@@ -14,15 +14,15 @@ Test stock browser for draft state
<!-- }}} -->
<!-- Check source -->
<tal:block tal:define="link_title python: 'erp5_pdm_ui_test_source_site';
<tal:block tal:define="node_category python: 'erp5_pdm_ui_test_source_site_title';
movement_count python: 0;">
<tal:block metal:use-macro="here/PdmZuite_checkStockBrowser/macros/init" />
<tal:block metal:use-macro="here/PdmZuite_checkStockBrowser/macros/check_inventory" />
</tal:block>
<!-- Check destination -->
<tal:block tal:define="link_title python: 'erp5_pdm_ui_test_destination_site';
<tal:block tal:define="node_category python: 'erp5_pdm_ui_test_destination_site_title';
movement_count python: 0;">
<tal:block metal:use-macro="here/PdmZuite_checkStockBrowser/macros/init" />
<tal:block metal:use-macro="here/PdmZuite_checkStockBrowser/macros/check_inventory" />
</tal:block>
......
......@@ -14,23 +14,23 @@ Test stock browser for ordered state
<!-- }}} -->
<!-- Check source -->
<tal:block tal:define="link_title python: 'erp5_pdm_ui_test_source_site';
<tal:block tal:define="node_category python: 'erp5_pdm_ui_test_source_site_title';
movement_count python: 1;
current_inventory python: 0.0;
available_inventory python: 0.0;
future_inventory python: -1.0;
">
<tal:block metal:use-macro="here/PdmZuite_checkStockBrowser/macros/init" />
<tal:block metal:use-macro="here/PdmZuite_checkStockBrowser/macros/check_inventory" />
</tal:block>
<!-- Check destination -->
<tal:block tal:define="link_title python: 'erp5_pdm_ui_test_destination_site';
<tal:block tal:define="node_category python: 'erp5_pdm_ui_test_destination_site_title';
movement_count python: 1;
current_inventory python: 0.0;
available_inventory python: 0.0;
future_inventory python: 1.0;
">
<tal:block metal:use-macro="here/PdmZuite_checkStockBrowser/macros/init" />
<tal:block metal:use-macro="here/PdmZuite_checkStockBrowser/macros/check_inventory" />
</tal:block>
</tbody></table>
......
......@@ -14,23 +14,23 @@ Test stock browser for planned state
<!-- }}} -->
<!-- Check source -->
<tal:block tal:define="link_title python: 'erp5_pdm_ui_test_source_site';
<tal:block tal:define="node_category python: 'erp5_pdm_ui_test_source_site_title';
movement_count python: 1;
current_inventory python: 0.0;
available_inventory python: 0.0;
future_inventory python: -1.0;
">
<tal:block metal:use-macro="here/PdmZuite_checkStockBrowser/macros/init" />
<tal:block metal:use-macro="here/PdmZuite_checkStockBrowser/macros/check_inventory" />
</tal:block>
<!-- Check destination -->
<tal:block tal:define="link_title python: 'erp5_pdm_ui_test_destination_site';
<tal:block tal:define="node_category python: 'erp5_pdm_ui_test_destination_site_title';
movement_count python: 1;
current_inventory python: 0.0;
available_inventory python: 0.0;
future_inventory python: 1.0;
">
<tal:block metal:use-macro="here/PdmZuite_checkStockBrowser/macros/init" />
<tal:block metal:use-macro="here/PdmZuite_checkStockBrowser/macros/check_inventory" />
</tal:block>
</tbody></table>
......
......@@ -14,23 +14,23 @@ Test stock browser for ready state
<!-- }}} -->
<!-- Check source -->
<tal:block tal:define="link_title python: 'erp5_pdm_ui_test_source_site';
<tal:block tal:define="node_category python: 'erp5_pdm_ui_test_source_site_title';
movement_count python: 1;
current_inventory python: 0.0;
available_inventory python: -1.0;
future_inventory python: -1.0;
">
<tal:block metal:use-macro="here/PdmZuite_checkStockBrowser/macros/init" />
<tal:block metal:use-macro="here/PdmZuite_checkStockBrowser/macros/check_inventory" />
</tal:block>
<!-- Check destination -->
<tal:block tal:define="link_title python: 'erp5_pdm_ui_test_destination_site';
<tal:block tal:define="node_category python: 'erp5_pdm_ui_test_destination_site_title';
movement_count python: 1;
current_inventory python: 0.0;
available_inventory python: 0.0;
future_inventory python: 1.0;
">
<tal:block metal:use-macro="here/PdmZuite_checkStockBrowser/macros/init" />
<tal:block metal:use-macro="here/PdmZuite_checkStockBrowser/macros/check_inventory" />
</tal:block>
</tbody></table>
......
......@@ -14,23 +14,23 @@ Test stock browser for started state
<!-- }}} -->
<!-- Check source -->
<tal:block tal:define="link_title python: 'erp5_pdm_ui_test_source_site';
<tal:block tal:define="node_category python: 'erp5_pdm_ui_test_source_site_title';
movement_count python: 1;
current_inventory python: -1.0;
available_inventory python: -1.0;
future_inventory python: -1.0;
">
<tal:block metal:use-macro="here/PdmZuite_checkStockBrowser/macros/init" />
<tal:block metal:use-macro="here/PdmZuite_checkStockBrowser/macros/check_inventory" />
</tal:block>
<!-- Check destination -->
<tal:block tal:define="link_title python: 'erp5_pdm_ui_test_destination_site';
<tal:block tal:define="node_category python: 'erp5_pdm_ui_test_destination_site_title';
movement_count python: 1;
current_inventory python: 0.0;
available_inventory python: 0.0;
future_inventory python: 1.0;
">
<tal:block metal:use-macro="here/PdmZuite_checkStockBrowser/macros/init" />
<tal:block metal:use-macro="here/PdmZuite_checkStockBrowser/macros/check_inventory" />
</tal:block>
</tbody></table>
......
......@@ -14,23 +14,23 @@ Test stock browser for stopped state
<!-- }}} -->
<!-- Check source -->
<tal:block tal:define="link_title python: 'erp5_pdm_ui_test_source_site';
<tal:block tal:define="node_category python: 'erp5_pdm_ui_test_source_site_title';
movement_count python: 1;
current_inventory python: -1.0;
available_inventory python: -1.0;
future_inventory python: -1.0;
">
<tal:block metal:use-macro="here/PdmZuite_checkStockBrowser/macros/init" />
<tal:block metal:use-macro="here/PdmZuite_checkStockBrowser/macros/check_inventory" />
</tal:block>
<!-- Check destination -->
<tal:block tal:define="link_title python: 'erp5_pdm_ui_test_destination_site';
<tal:block tal:define="node_category python: 'erp5_pdm_ui_test_destination_site_title';
movement_count python: 1;
current_inventory python: 1.0;
available_inventory python: 1.0;
future_inventory python: 1.0;
">
<tal:block metal:use-macro="here/PdmZuite_checkStockBrowser/macros/init" />
<tal:block metal:use-macro="here/PdmZuite_checkStockBrowser/macros/check_inventory" />
</tal:block>
</tbody></table>
......
......@@ -70,11 +70,6 @@
<td>//button[@name="Base_doReport:method"]</td>
<td></td>
</tr>
<tr>
<td>clickAndWait</td>
<td>//input[@class="listbox-tree-domain-tree-mode"]</td>
<td></td>
</tr>
</tal:block>
<tal:block metal:define-macro="toggleSaleSupplyLineBasePricePerSlice">
......
<tal:block xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal">
<tal:block metal:define-macro="init" tal:define="base_url python: '/' + here.getPortalObject().getId()">
<tal:block metal:define-macro="check_inventory" tal:define="base_url python: '/' + here.getPortalObject().getId()">
<!-- Click on + link -->
<!-- Select node category in dialog -->
<tr>
<td>select</td>
<td>//select[@name="field_your_node_category"]</td>
<td tal:content='node_category'></td>
</tr>
<tr>
<td>clickAndWait</td>
<td tal:content='string://button[@value="site/${link_title}.0"]'>link=node</td>
<td>Base_callDialogMethod:method</td>
<td></td>
</tr>
......@@ -50,6 +55,18 @@
<td>//a[@class="listbox_title"]</td>
<td></td>
</tr>
<!-- Select node category in dialog (again) -->
<tr>
<td>select</td>
<td>//select[@name="field_your_node_category"]</td>
<td tal:content='node_category'></td>
</tr>
<tr>
<td>clickAndWait</td>
<td>Base_callDialogMethod:method</td>
<td></td>
</tr>
</tal:block>
</tal:block>
</tal:block>
......
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