Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5_fork
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Eteri
erp5_fork
Commits
9fdaa99a
Commit
9fdaa99a
authored
Jan 20, 2021
by
Kazuhiko Shiozaki
Committed by
Romain Courteaud
Jan 27, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_web_renderjs_ui: fix a percent FloatField issue with a RelationField.
parent
c2437851
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
753 additions
and
1 deletion
+753
-1
bt5/erp5_ui_test/PropertySheetTemplateItem/portal_property_sheets/Foo/delivery_ratio_property.xml
...em/portal_property_sheets/Foo/delivery_ratio_property.xml
+57
-0
bt5/erp5_ui_test/SkinTemplateItem/portal_skins/erp5_ui_test/Foo_view.xml
...t/SkinTemplateItem/portal_skins/erp5_ui_test/Foo_view.xml
+2
-0
bt5/erp5_ui_test/SkinTemplateItem/portal_skins/erp5_ui_test/Foo_view/my_delivery_ratio.xml
.../portal_skins/erp5_ui_test/Foo_view/my_delivery_ratio.xml
+256
-0
bt5/erp5_ui_test/SkinTemplateItem/portal_skins/erp5_ui_test/Foo_view/my_delivery_ratio_read_only.xml
...ins/erp5_ui_test/Foo_view/my_delivery_ratio_read_only.xml
+271
-0
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_floatfield_js.js
...lateItem/web_page_module/rjs_gadget_erp5_floatfield_js.js
+4
-1
bt5/erp5_web_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_float_field_zuite/testFloatFieldPercent.xml
...s/renderjs_ui_float_field_zuite/testFloatFieldPercent.xml
+58
-0
bt5/erp5_web_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_float_field_zuite/testFloatFieldPercent.zpt
...s/renderjs_ui_float_field_zuite/testFloatFieldPercent.zpt
+105
-0
No files found.
bt5/erp5_ui_test/PropertySheetTemplateItem/portal_property_sheets/Foo/delivery_ratio_property.xml
0 → 100644
View file @
9fdaa99a
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Standard Property"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_local_properties
</string>
</key>
<value>
<tuple>
<dictionary>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
mode
</string>
</value>
</item>
<item>
<key>
<string>
type
</string>
</key>
<value>
<string>
string
</string>
</value>
</item>
</dictionary>
</tuple>
</value>
</item>
<item>
<key>
<string>
categories
</string>
</key>
<value>
<tuple>
<string>
elementary_type/float
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<string>
ratio to apply on the quantity property of thecorresponding delivery to obtain the current quantity
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
delivery_ratio_property
</string>
</value>
</item>
<item>
<key>
<string>
mode
</string>
</key>
<value>
<string>
w
</string>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Standard Property
</string>
</value>
</item>
<item>
<key>
<string>
property_default
</string>
</key>
<value>
<string>
python: 1.0
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_ui_test/SkinTemplateItem/portal_skins/erp5_ui_test/Foo_view.xml
View file @
9fdaa99a
...
...
@@ -120,6 +120,8 @@
<string>
my_quantity_read_only
</string>
<string>
my_quantity_read_only_percent
</string>
<string>
my_price
</string>
<string>
my_delivery_ratio
</string>
<string>
my_delivery_ratio_read_only
</string>
<string>
my_frozen
</string>
<string>
my_lines_list
</string>
</list>
...
...
bt5/erp5_ui_test/SkinTemplateItem/portal_skins/erp5_ui_test/Foo_view/my_delivery_ratio.xml
0 → 100644
View file @
9fdaa99a
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"FloatField"
module=
"Products.Formulator.StandardFields"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
my_delivery_ratio
</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>
<item>
<key>
<string>
not_float
</string>
</key>
<value>
<string>
You did not enter a floating point number.
</string>
</value>
</item>
<item>
<key>
<string>
required_not_found
</string>
</key>
<value>
<string>
Input is required but no input given.
</string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
overrides
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
alternate_name
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
css_class
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
default
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
display_maxwidth
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
display_width
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
editable
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
enabled
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
external_validator
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
extra
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
hidden
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
input_style
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
precision
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
required
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
whitespace_preserve
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
tales
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
alternate_name
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
css_class
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
default
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
display_maxwidth
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
display_width
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
editable
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
enabled
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
external_validator
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
extra
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
hidden
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
input_style
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
input_type
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
precision
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
required
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
whitespace_preserve
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
values
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
alternate_name
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
css_class
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
default
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
display_maxwidth
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
display_width
</string>
</key>
<value>
<int>
20
</int>
</value>
</item>
<item>
<key>
<string>
editable
</string>
</key>
<value>
<int>
1
</int>
</value>
</item>
<item>
<key>
<string>
enabled
</string>
</key>
<value>
<int>
1
</int>
</value>
</item>
<item>
<key>
<string>
external_validator
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
extra
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
hidden
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
<item>
<key>
<string>
input_style
</string>
</key>
<value>
<string>
-12.3%
</string>
</value>
</item>
<item>
<key>
<string>
input_type
</string>
</key>
<value>
<string>
text
</string>
</value>
</item>
<item>
<key>
<string>
precision
</string>
</key>
<value>
<int>
1
</int>
</value>
</item>
<item>
<key>
<string>
required
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
Delivery Ratio
</string>
</value>
</item>
<item>
<key>
<string>
whitespace_preserve
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_ui_test/SkinTemplateItem/portal_skins/erp5_ui_test/Foo_view/my_delivery_ratio_read_only.xml
0 → 100644
View file @
9fdaa99a
This diff is collapsed.
Click to expand it.
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_floatfield_js.js
View file @
9fdaa99a
...
...
@@ -53,7 +53,10 @@
if
(
percentage
)
{
// ERP5 always devides the value by 100 if it is set to percentages
// thus we have to mitigate that in javascript here
state_dict
.
value
*=
100.0
;
// (field_json.default type is number, only when it is initially loaded)
if
(
typeof
(
field_json
.
default
)
==
'
number
'
)
{
state_dict
.
value
*=
100.0
;
}
state_dict
.
append
=
"
%
"
;
}
if
(
!
window
.
isNaN
(
state_dict
.
precision
))
{
...
...
bt5/erp5_web_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_float_field_zuite/testFloatFieldPercent.xml
0 → 100644
View file @
9fdaa99a
<?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>
testFloatFieldPercent
</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>
bt5/erp5_web_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_float_field_zuite/testFloatFieldPercent.zpt
0 → 100644
View file @
9fdaa99a
<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 Float Value with Float Fields
</title>
</head>
<body>
<table
cellpadding=
"1"
cellspacing=
"1"
border=
"1"
>
<thead>
<tr><td
rowspan=
"1"
colspan=
"3"
>
Test basic functionality and decimal precision in both modes (non/editable)
</td></tr>
</thead><tbody>
<tal:block
metal:use-macro=
"here/PTZuite_CommonTemplate/macros/init"
/>
<!-- Shortcut for full renderjs url -->
<tr><td>
store
</td>
<td>
${base_url}/web_site_module/renderjs_runner
</td>
<td>
renderjs_url
</td></tr>
<tr><td>
open
</td>
<td>
${renderjs_url}/#/foo_module/1?editable=1
</td><td></td></tr>
<tal:block
metal:use-macro=
"here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_app_loaded"
/>
<tr><td>
assertText
</td>
<td>
//div[@data-gadget-scope="field_my_delivery_ratio_read_only"]//p
</td>
<td>
100.0%
</td></tr>
<tr><td>
assertValue
</td>
<td>
//input[@name="field_my_delivery_ratio"]
</td>
<td>
100.0
</td></tr>
<tr><td>
assertElementPresent
</td>
<td>
//div[@data-gadget-scope="field_my_delivery_ratio"]//i[text()='%']
</td><td></td></tr>
<tr><td>
fireEvent
</td>
<td>
field_my_delivery_ratio
</td>
<td>
focus
</td></tr>
<tr><td>
type
</td>
<td>
field_my_delivery_ratio
</td>
<td>
12.34
</td></tr>
<tr><td>
fireEvent
</td>
<td>
field_my_quantity
</td>
<td>
blur
</td></tr>
<tal:block
metal:use-macro=
"here/Zuite_CommonTemplateForRenderjsUi/macros/click_save"
/>
<tr><td>
waitForElementPresent
</td>
<td>
//button[text()="Input data has errors."]
</td><td></td></tr>
<tal:block
tal:define=
"notification_configuration python: {'class': 'error',
'text': 'Input data has errors.'}"
>
<tal:block
metal:use-macro=
"here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_notification"
/>
</tal:block>
<tr>
<td>
waitForElementPresent
</td>
<td>
//input[@name="field_my_delivery_ratio" and @class="is-invalid"]
</td>
<td></td>
</tr>
<tr>
<td>
waitForElementPresent
</td>
<td>
//input[@name="field_my_delivery_ratio" and @class="is-invalid"]
</td>
<td></td>
</tr>
<tr>
<td>
fireEvent
</td>
<td>
//input[@name="field_my_delivery_ratio" and @class="is-invalid"]
</td>
<td>
focus
</td>
</tr>
<tr><td>
assertElementPresent
</td>
<td>
//div[@data-gadget-scope="field_my_delivery_ratio"]//span[text()='The number you input has too large precision.']
</td><td></td></tr>
<tr><td>
type
</td>
<td>
field_my_delivery_ratio
</td>
<td>
20.0
</td></tr>
<tr><td>
fireEvent
</td>
<td>
field_my_delivery_ratio
</td>
<td>
blur
</td></tr>
<tr><td>
assertElementNotPresent
</td>
<td>
//div[@data-gadget-scope="field_my_delivery_ratio"]//span[text()='The number you input has too large precision.']
</td><td></td></tr>
<tal:block
metal:use-macro=
"here/Zuite_CommonTemplateForRenderjsUi/macros/save"
/>
<tr><td>
verifyValue
</td>
<td>
field_my_delivery_ratio
</td>
<td>
20.0
</td></tr>
<tr><td>
verifyText
</td>
<td>
//div[@data-gadget-scope="field_my_delivery_ratio_read_only"]//p
</td>
<td>
20.0%
</td></tr>
<tr><td>
click
</td>
<td>
//div[@data-gadget-scope='field_my_foo_category_title']//button
</td><td></td></tr>
<tr><td>
waitForElementPresent
</td>
<td>
//div[@data-gadget-scope='field_listbox']//h1[text()='Foo Category ']
</td><td></td></tr>
<tr><td>
waitForElementPresent
</td>
<td>
//div[@data-gadget-scope='header']//a[@data-i18n='Foo: Title 1']
</td><td></td>
<tr><td>
click
</td>
<td>
//div[@data-gadget-scope='header']//a[@data-i18n='Foo: Title 1']
</td><td></td></tr>
<tr><td>
waitForElementPresent
</td>
<td>
field_my_delivery_ratio
</td><td></td></tr>
<tr><td>
waitForElementPresent
</td>
<td>
//div[@data-gadget-scope="field_my_delivery_ratio_read_only"]//p
</td><td></td></tr>
<tr><td>
verifyValue
</td>
<td>
field_my_delivery_ratio
</td>
<td>
20.0
</td></tr>
<tr><td>
verifyElementPresent
</td>
<td>
//div[@data-gadget-scope="field_my_delivery_ratio"]//i[text()='%']
</td><td></td></tr>
<tr><td>
verifyText
</td>
<td>
//div[@data-gadget-scope="field_my_delivery_ratio_read_only"]//p
</td>
<td>
20.0%
</td></tr>
</tbody></table>
</body>
</html>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment