[IMP] fields: speedup `Float.convert_to_cache` by not rounding the value

This commit is contained in:
Raphael Collet 2016-01-28 16:36:24 +01:00
parent f0646cb51b
commit 812332855a
1 changed files with 2 additions and 0 deletions

View File

@ -1096,6 +1096,8 @@ class Float(Field):
def convert_to_cache(self, value, record, validate=True):
# apply rounding here, otherwise value in cache may be wrong!
value = float(value or 0.0)
if not validate:
return value
digits = self.digits
return float_round(value, precision_digits=digits[1]) if digits else value