From c22b85dd7355ebea052b8109d9fc45b542dd559a Mon Sep 17 00:00:00 2001 From: David Monjoie Date: Thu, 16 Mar 2017 15:29:32 +0100 Subject: [ADD] web: add float field tests and documentation --- addons/web/static/src/js/fields/basic_fields.js | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'addons/web/static/src/js/fields/basic_fields.js') diff --git a/addons/web/static/src/js/fields/basic_fields.js b/addons/web/static/src/js/fields/basic_fields.js index d3dab0fe647..6f182aa90ab 100644 --- a/addons/web/static/src/js/fields/basic_fields.js +++ b/addons/web/static/src/js/fields/basic_fields.js @@ -412,6 +412,23 @@ var FieldFloat = InputField.extend({ } }, + //-------------------------------------------------------------------------- + // Public + //-------------------------------------------------------------------------- + + /** + * For float fields, 0 is a valid value. + * + * @override + */ + isSet: function () { + return this.value === 0 || this._super.apply(this, arguments); + }, + + //-------------------------------------------------------------------------- + // Private + //-------------------------------------------------------------------------- + /** * Format value according to precision parameter. * @@ -426,9 +443,6 @@ var FieldFloat = InputField.extend({ var $span = $('').addClass('o_form_field o_form_field_number').text(this._formatValue(value)); this.$el.html($span); }, - isSet: function () { - return this.value !== ''; - }, }); var FieldFloatTime = FieldFloat.extend({ -- cgit v1.2.3