summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js
diff options
context:
space:
mode:
authorAaron Bohy <aab@odoo.com>2017-05-04 14:57:30 +0200
committerAaron Bohy <aab@odoo.com>2017-05-04 15:48:44 +0200
commit32d669da1febb331986c8a6fb541f0356387676a (patch)
tree4a0bbbbe8b263fde4685582beee7eba90639f850 /addons/web/static/src/js
parent794345bad1b5432ca1349fcc27119402e5395235 (diff)
[FIX] web: correctly parse monetary fields
Before this rev., the function that parses monetary fields (i.e. the one that converts the string value of the input into a numerical value) totally ignored the sign of the value. Actually, parsing a monetary field is exactly the same as parsing a float field, so we simply use the same function.
Diffstat (limited to 'addons/web/static/src/js')
-rw-r--r--addons/web/static/src/js/fields/field_utils.js10
1 files changed, 1 insertions, 9 deletions
diff --git a/addons/web/static/src/js/fields/field_utils.js b/addons/web/static/src/js/fields/field_utils.js
index 508d97b131c..9a683954e7e 100644
--- a/addons/web/static/src/js/fields/field_utils.js
+++ b/addons/web/static/src/js/fields/field_utils.js
@@ -401,14 +401,6 @@ function parseInteger(value) {
return parsed;
}
-function parseMonetary(formatted_value) {
- var l10n = core._t.database.parameters;
- var value = formatted_value.replace(l10n.thousands_sep, '')
- .replace(l10n.decimal_point, '.')
- .match(/([0-9]+(\.[0-9]*)?)/)[1];
- return parseFloat(value);
-}
-
/**
* Creates an object with id and display_name.
*
@@ -468,7 +460,7 @@ return {
integer: parseInteger,
many2many: _.identity, // todo
many2one: parseMany2one,
- monetary: parseMonetary,
+ monetary: parseFloat,
one2many: _.identity,
reference: _.identity, // todo
selection: _.identity, // todo