diff --git a/addons/web/static/src/js/formats.js b/addons/web/static/src/js/formats.js index 4766fe33433..54f74f29fbf 100644 --- a/addons/web/static/src/js/formats.js +++ b/addons/web/static/src/js/formats.js @@ -368,4 +368,9 @@ instance.web.round_decimals = function(value, decimals){ return instance.web.round_precision(value, Math.pow(10,-decimals)); }; +instance.web.float_is_zero = function(value, decimals){ + epsilon = Math.pow(10, -decimals); + return Math.abs(instance.web.round_precision(value, epsilon)) < epsilon; +}; + })(); diff --git a/addons/web/static/src/js/openerpframework.js b/addons/web/static/src/js/openerpframework.js index 007edae7220..ed80a3abc87 100644 --- a/addons/web/static/src/js/openerpframework.js +++ b/addons/web/static/src/js/openerpframework.js @@ -468,6 +468,9 @@ openerp.PropertiesMixin = _.extend({}, openerp.EventDispatcherMixin, { var tmp = self.__getterSetterInternalMap[key]; if (tmp === val) return; + if (self.field && self.field.type === 'float' && tmp && val && openerp.web.float_is_zero(tmp - val, self.field.digits[1])){ + return; + } changed = true; self.__getterSetterInternalMap[key] = val; if (! options.silent)