[FIX] web: float seen as changed with digits set to 0

Do not check float_is_zero for float fields with
digits specifically set to 0, it means
the rounding precision is infintie for those ones,
and tmp === val is enough.
This commit is contained in:
Denis Ledoux 2015-04-03 16:37:28 +02:00
parent 3171fd472e
commit 8121f29848
1 changed files with 7 additions and 3 deletions

View File

@ -469,9 +469,13 @@ openerp.PropertiesMixin = _.extend({}, openerp.EventDispatcherMixin, {
if (tmp === val) if (tmp === val)
return; return;
if (key === 'value' && self.field && self.field.type === 'float' && tmp && val){ if (key === 'value' && self.field && self.field.type === 'float' && tmp && val){
var precision = self.field.digits ? self.field.digits[1] : 2; var digits = self.field.digits;
if (openerp.web.float_is_zero(tmp - val, precision)) if (digits !== 0){
return; digits = digits ? digits[1] : 2;
if (openerp.web.float_is_zero(tmp - val, digits)){
return;
}
}
} }
changed = true; changed = true;
self.__getterSetterInternalMap[key] = val; self.__getterSetterInternalMap[key] = val;