From 2a86e9245c91d6564257aad4ed69673576f10918 Mon Sep 17 00:00:00 2001 From: "Lucas Perais (lpe)" Date: Fri, 1 Dec 2017 11:35:03 +0100 Subject: [FIX][BACKPORT] Always round monetary values in database backport of afef71d6b92a2741ab56b4d039eba1624a45197f Original commit message: Let `create` and `write` round monetary field values before sending them to the database. Pass the values to be written to `field.convert_to_column`, so that the currency can be retrieved from the values, and the value be rounded. --- odoo/tools/float_utils.py | 18 ------------------ 1 file changed, 18 deletions(-) (limited to 'odoo/tools/float_utils.py') diff --git a/odoo/tools/float_utils.py b/odoo/tools/float_utils.py index 67777145dba..b5be74023bb 100644 --- a/odoo/tools/float_utils.py +++ b/odoo/tools/float_utils.py @@ -150,24 +150,6 @@ def float_repr(value, precision_digits): _float_repr = float_repr -class float_precision(float): - """ A class for float values that carry precision digits. This is a thin - layer on top of ``float``, and the precision digits are not propagated - to the result of arithmetic operations. This class is used when - converting monetary values to cache, and for serializing them to the - database. - """ - __slots__ = ['precision_digits'] - - def __new__(cls, value, precision_digits): - obj = super(float_precision, cls).__new__(cls, value) - obj.precision_digits = precision_digits - return obj - - def float_repr(self): - return _float_repr(self, self.precision_digits) - - if __name__ == "__main__": import time -- cgit v1.2.3