From 32d669da1febb331986c8a6fb541f0356387676a Mon Sep 17 00:00:00 2001 From: Aaron Bohy Date: Thu, 4 May 2017 14:57:30 +0200 Subject: [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. --- addons/web/static/src/js/fields/field_utils.js | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'addons/web/static/src/js/fields/field_utils.js') 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 -- cgit v1.2.3