parse_value: interger != float
authorMartin Trigaux <mat@openerp.com>
Thu, 12 Jun 2014 10:24:48 +0000 (12:24 +0200)
committerMartin Trigaux <mat@openerp.com>
Thu, 12 Jun 2014 11:48:41 +0000 (13:48 +0200)
Wwhen parsing a integer field, do not accept float values. '1' or '1.0' is ok but not '1.1'. (opw 608544)

addons/web/static/src/js/formats.js

index 3280b9f..0c3577b 100644 (file)
@@ -228,7 +228,8 @@ instance.web.parse_value = function (value, descriptor, value_if_empty) {
                 value = value.replace(instance.web._t.database.parameters.thousands_sep, "");
             } while(tmp !== value);
             tmp = Number(value);
-            if (isNaN(tmp))
+            // do not accept not numbers or float values
+            if (isNaN(tmp) || tmp % 1)
                 throw new Error(_.str.sprintf(_t("'%s' is not a correct integer"), value));
             return tmp;
         case 'float':