Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
erp5_workflow
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wenjie.zheng
erp5_workflow
Commits
580a4224
Commit
580a4224
authored
Apr 19, 2013
by
Arnaud Fontaine
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Formulator: FloatField with precision equals to 0 didn't apply input_style (
ce667c12
).
parent
af640e28
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
2 deletions
+8
-2
product/ERP5Form/tests/testFields.py
product/ERP5Form/tests/testFields.py
+6
-1
product/Formulator/Widget.py
product/Formulator/Widget.py
+2
-1
No files found.
product/ERP5Form/tests/testFields.py
View file @
580a4224
...
...
@@ -106,6 +106,11 @@ class TestFloatField(ERP5TypeTestCase):
self
.
assertEquals
(
'100,000.0'
,
self
.
widget
.
format_value
(
self
.
field
,
100000
))
self
.
assertEquals
(
'-100,000.0'
,
self
.
widget
.
format_value
(
self
.
field
,
-
100000
))
def
test_format_with_separator_and_precision0
(
self
):
self
.
field
.
values
[
'input_style'
]
=
'-1,234.5'
self
.
field
.
values
[
'precision'
]
=
0
self
.
assertEquals
(
'-1,000'
,
self
.
widget
.
format_value
(
self
.
field
,
-
1000.25
))
def
test_format_percent_style
(
self
):
self
.
field
.
values
[
'input_style'
]
=
'-12.3%'
self
.
assertEquals
(
'10.0%'
,
self
.
widget
.
format_value
(
self
.
field
,
0.1
))
...
...
product/Formulator/Widget.py
View file @
580a4224
...
...
@@ -1823,6 +1823,7 @@ class FloatWidget(TextWidget):
# just return it as is
if
'e'
in
value
:
return
value
if
precision
!=
0
:
value
,
fpart
=
value
.
split
(
'.'
)
except
ValueError
:
return
value
...
...
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