Commit 4f385666 authored by Jérome Perrin's avatar Jérome Perrin

Fix component stock browser with ERP5JS

See merge request nexedi/erp5!1144
parents 3700e8e1 61e686f2
Pipeline #9795 failed with stage
in 0 seconds
<?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_view</string>
</tuple>
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_jio_view</string> </value>
</item>
<item>
<key> <string>condition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>icon</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>view_movement_history</string> </value>
</item>
<item>
<key> <string>permissions</string> </key>
<value>
<tuple>
<string>View</string>
</tuple>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Action Information</string> </value>
</item>
<item>
<key> <string>priority</string> </key>
<value> <float>3.0</float> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Movement History</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>string:${object_url}/Resource_viewMovementHistory</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -9,6 +9,7 @@ Component | purchase_price_view ...@@ -9,6 +9,7 @@ Component | purchase_price_view
Component | sale_price_view Component | sale_price_view
Component | view Component | view
Component | view_measure Component | view_measure
Component | view_movement_history
Component | view_stock Component | view_stock
Internal Supply Line | additional_price Internal Supply Line | additional_price
Internal Supply Line | base_price Internal Supply Line | base_price
......
<?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>testComponentStoppedState</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>
<head><title>Test stock browser for components portal type</title></head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="4">
Test stock browser for components portal type
</td></tr>
</thead>
<tbody tal:define="resource_relative_url string:component_module/erp5_pdm_ui_test_component;
init_method string:PdmZuite_createDelivery?state=stopped&resource_relative_url=$resource_relative_url">
<!-- Setup {{{ -->
<tal:block metal:use-macro="here/PdmZuite_CommonTemplateForRenderjsUi/macros/init" />
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_listbox_loaded" />
<!-- Check destination -->
<tal:block tal:define="title python: 'erp5_pdm_ui_test_destination_node_title';
index python: 1;
current_inventory python: 1.0;
available_inventory python: 1.0;
future_inventory python: 1.0;
">
<tal:block metal:use-macro="here/PdmZuite_checkStockBrowserForRenderjsUi/macros/init" />
</tal:block>
<!-- Check source -->
<tal:block tal:define="title python: 'erp5_pdm_ui_test_source_node_title';
index python: 2;
current_inventory python: -1.0;
available_inventory python: -1.0;
future_inventory python: -1.0;
">
<tal:block metal:use-macro="here/PdmZuite_checkStockBrowserForRenderjsUi/macros/init" />
</tal:block>
<!-- Check for total value -->
<tal:block tal:define="current_inventory python: 0.0;
available_inventory python: 0.0;
future_inventory python: 0.0;
">
<tal:block metal:use-macro="here/PdmZuite_checkStockBrowserForRenderjsUi/macros/check_total_for_inventory" />
</tal:block>
<tal:block metal:use-macro="here/PdmZuite_CommonTemplateForRenderjsUi/macros/check_links_for_stocks" />
<!-- Check the links in hardcoded way -->
<!-- TODO: If possible, move to macros -->
<tr>
<td>waitForElementPresent</td>
<td>//div[@data-gadget-scope='field_listbox']//table/tbody/tr[1]/td[1]/a</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//div[@data-gadget-scope='field_listbox']//table/tbody/tr[1]/td[1]/a</td>
<td></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_listbox_loaded" />
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tal:block tal:define="pagination_configuration python: {'header': '(1)', 'footer': '1 Records'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/check_listbox_pagination_text" />
</tal:block>
<tr>
<td>waitForElementPresent</td>
<td>//div[@data-gadget-scope='field_listbox']//table/tbody</td>
<td></td>
</tr>
<tr>
<td>verifyText</td>
<td>//div[@data-gadget-scope='field_listbox']//table/tbody/tr[1]/td[3]</td>
<td>erp5_pdm_ui_test_destination_node_title</td>
</tr>
<tal:block metal:use-macro="here/PdmZuite_CommonTemplateForRenderjsUi/macros/check_links" />
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_listbox_loaded" />
<tal:block metal:use-macro="here/PdmZuite_CommonTemplateForRenderjsUi/macros/go_to_stock_view" />
<tr>
<td>assertElementPresent</td>
<td>//div[@data-gadget-scope='field_listbox']//table/tbody/tr[1]/td[5]/a</td>
<td></td>
</tr>
</tbody></table>
</body>
</html>
<!-- vim: syntax=html foldmethod=marker -->
\ No newline at end of file
<tal:block xmlns:tal="http://xml.zope.org/namespaces/tal" <tal:block xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal"> xmlns:metal="http://xml.zope.org/namespaces/metal">
<tal:block metal:define-macro="init"> <tal:block metal:define-macro="init"
tal:define="resource_relative_url resource_relative_url | string:product_module/erp5_pdm_ui_test_product">
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/init" /> <tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/init" />
<tr> <tr>
<td>open</td> <td>open</td>
...@@ -57,7 +58,7 @@ ...@@ -57,7 +58,7 @@
</tr> </tr>
<tr> <tr>
<td>open</td> <td>open</td>
<td>${base_url}/web_site_module/renderjs_runner/#/product_module/erp5_pdm_ui_test_product</td> <td>${base_url}/web_site_module/renderjs_runner/#/<tal:block tal:replace="resource_relative_url"></tal:block></td>
<td></td> <td></td>
</tr> </tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_app_loaded" /> <tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_app_loaded" />
......
...@@ -12,11 +12,8 @@ delivery_title = "erp5_pdm_ui_test_delivery_title" ...@@ -12,11 +12,8 @@ delivery_title = "erp5_pdm_ui_test_delivery_title"
source_node_id = "erp5_pdm_ui_test_source_node" source_node_id = "erp5_pdm_ui_test_source_node"
destination_node_id = "erp5_pdm_ui_test_destination_node" destination_node_id = "erp5_pdm_ui_test_destination_node"
resource_id = "erp5_pdm_ui_test_product"
business_process_id = 'erp5_default_business_process' business_process_id = 'erp5_default_business_process'
quantity = 1
business_process_module = portal.getDefaultModule("Business Process") business_process_module = portal.getDefaultModule("Business Process")
business_process = getattr(business_process_module, business_process_id, None) business_process = getattr(business_process_module, business_process_id, None)
if business_process is None: if business_process is None:
...@@ -40,9 +37,9 @@ if state in ['planned', 'ordered']: ...@@ -40,9 +37,9 @@ if state in ['planned', 'ordered']:
specialise_value=business_process, specialise_value=business_process,
start_date=DateTime(), start_date=DateTime(),
) )
order_line = order.newContent( order.newContent(
portal_type=order_line_portal_type, portal_type=order_line_portal_type,
resource='product_module/%s' % resource_id, resource=resource_relative_url,
quantity=1, quantity=1,
) )
order.portal_workflow.doActionFor(order, 'plan_action') order.portal_workflow.doActionFor(order, 'plan_action')
...@@ -63,9 +60,9 @@ else: ...@@ -63,9 +60,9 @@ else:
specialise_value=business_process, specialise_value=business_process,
start_date=DateTime(), start_date=DateTime(),
) )
delivery_line = delivery.newContent( delivery.newContent(
portal_type=delivery_line_portal_type, portal_type=delivery_line_portal_type,
resource='product_module/%s' % resource_id, resource=resource_relative_url,
quantity=1, quantity=1,
) )
for next_state, transition in [ for next_state, transition in [
...@@ -87,8 +84,6 @@ else: ...@@ -87,8 +84,6 @@ else:
break break
if delivery.getSimulationState() != state: if delivery.getSimulationState() != state:
raise ImplementationError, 'Delivery state is %s and not %s' % (delivery.getSimulationState(), state) raise NotImplementedError('Delivery state is %s and not %s' % (delivery.getSimulationState(), state))
return "Delivery Created." return "Delivery Created."
# vim: syntax=python
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>state, delivery_type="Sale"</string> </value> <value> <string>state, delivery_type="Sale", resource_relative_url="product_module/erp5_pdm_ui_test_product"</string> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
......
portal = context.getPortalObject() portal = context.getPortalObject()
resource_portal_type = "Product"
node_portal_type = "Organisation" node_portal_type = "Organisation"
site_portal_type = "Category"
resource_id = "erp5_pdm_ui_test_product"
source_node_id = "erp5_pdm_ui_test_source_node" source_node_id = "erp5_pdm_ui_test_source_node"
destination_node_id = "erp5_pdm_ui_test_destination_node" destination_node_id = "erp5_pdm_ui_test_destination_node"
...@@ -14,10 +9,11 @@ destination_site_id = "erp5_pdm_ui_test_destination_site" ...@@ -14,10 +9,11 @@ destination_site_id = "erp5_pdm_ui_test_destination_site"
delivery_id = "erp5_pdm_ui_test_delivery" delivery_id = "erp5_pdm_ui_test_delivery"
# Delete resource # Delete resources
module = portal.getDefaultModule(resource_portal_type) if getattr(portal.product_module, 'erp5_pdm_ui_test_product', None) is not None:
if getattr(module, resource_id, None) is not None: portal.product_module.manage_delObjects(['erp5_pdm_ui_test_product'])
module.manage_delObjects([resource_id]) if getattr(portal.component_module, 'erp5_pdm_ui_test_component', None) is not None:
portal.component_module.manage_delObjects(['erp5_pdm_ui_test_component'])
# Delete nodes # Delete nodes
module = portal.getDefaultModule(node_portal_type) module = portal.getDefaultModule(node_portal_type)
......
portal = context.getPortalObject() portal = context.getPortalObject()
self = context
resource_portal_type = "Product"
node_portal_type = "Organisation" node_portal_type = "Organisation"
site_portal_type = "Category" site_portal_type = "Category"
resource_id = "erp5_pdm_ui_test_product"
resource_title = "erp5_pdm_ui_test_product_title"
source_node_id = "erp5_pdm_ui_test_source_node" source_node_id = "erp5_pdm_ui_test_source_node"
source_node_title = "erp5_pdm_ui_test_source_node_title" source_node_title = "erp5_pdm_ui_test_source_node_title"
destination_node_id = "erp5_pdm_ui_test_destination_node" destination_node_id = "erp5_pdm_ui_test_destination_node"
...@@ -22,27 +18,31 @@ for rule in portal.portal_rules.objectValues(): ...@@ -22,27 +18,31 @@ for rule in portal.portal_rules.objectValues():
if rule.getValidationState() != 'validated': if rule.getValidationState() != 'validated':
rule.validate() rule.validate()
# Create resource # Create resources
if getattr(quantity_unit_category, "unit", None) is None: if getattr(quantity_unit_category, "unit", None) is None:
quantity_unit_category.newContent( quantity_unit_category.newContent(
portal_type="Category", portal_type="Category",
id="unit" id="unit"
) )
module = portal.getDefaultModule(resource_portal_type) portal.product_module.newContent(
portal_type='Product',
resource = module.newContent( id='erp5_pdm_ui_test_product',
portal_type=resource_portal_type, title='erp5_pdm_ui_test_product_title',
id=resource_id, quantity_unit='unit',
title=resource_title, ).validate()
portal.component_module.newContent(
portal_type='Component',
id='erp5_pdm_ui_test_component',
title='erp5_pdm_ui_test_component_title',
quantity_unit='unit', quantity_unit='unit',
) ).validate()
resource.validate()
# Create site categories # Create site categories
base_category = portal.restrictedTraverse('portal_categories/site') base_category = portal.restrictedTraverse('portal_categories/site')
for site_id, site_title in ((source_site_id, source_site_title), for site_id, site_title in ((source_site_id, source_site_title),
(destination_site_id, destination_site_title)): (destination_site_id, destination_site_title)):
site = base_category.newContent( base_category.newContent(
portal_type=site_portal_type, portal_type=site_portal_type,
id=site_id, id=site_id,
title=site_title title=site_title
...@@ -52,7 +52,7 @@ for site_id, site_title in ((source_site_id, source_site_title), ...@@ -52,7 +52,7 @@ for site_id, site_title in ((source_site_id, source_site_title),
for node_id, node_title, site_url in ((source_node_id, source_node_title, source_site_id), for node_id, node_title, site_url in ((source_node_id, source_node_title, source_site_id),
(destination_node_id, destination_node_title, destination_site_id)): (destination_node_id, destination_node_title, destination_site_id)):
module = portal.getDefaultModule(node_portal_type) module = portal.getDefaultModule(node_portal_type)
node = module.newContent( module.newContent(
portal_type=node_portal_type, portal_type=node_portal_type,
id=node_id, id=node_id,
title=node_title, title=node_title,
......
...@@ -170,6 +170,13 @@ ignored_skin_id_set = { ...@@ -170,6 +170,13 @@ ignored_skin_id_set = {
'DeliveryModule_mergeDeliveryList', 'DeliveryModule_mergeDeliveryList',
'ERP5VCS_doCreateJavaScriptDiff.js', 'ERP5VCS_doCreateJavaScriptDiff.js',
'ERP5VCS_doCreateJavaScriptStatus.js', 'ERP5VCS_doCreateJavaScriptStatus.js',
'PdmZuite_CommonTemplate',
'PdmZuite_checkStockBrowser',
'PdmZuite_createDelivery',
'PdmZuite_deleteData',
'PdmZuite_reset',
'PdmZuite_CommonTemplateForRenderjsUi',
'PdmZuite_checkStockBrowserForRenderjsUi',
} }
# Generic method to check consistency of a skin item # Generic method to check consistency of a skin item
......
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