The goal is to prevent to introduce float errors in Numeric fields. There is a trick for external protocols like XML-RPC and JSON-RPC where the string representation is stored in the Float object and will be used to convert it into Decimal.
19 lines
437 B
Python
19 lines
437 B
Python
#This file is part of Tryton. The COPYRIGHT file at the top level of
|
|
#this repository contains the full copyright notices and license terms.
|
|
|
|
class Float(float):
|
|
|
|
def __init__(self, value):
|
|
super(Float, self).__init__()
|
|
self.__decimal = value
|
|
|
|
@property
|
|
def decimal(self):
|
|
return self.__decimal
|
|
|
|
def __repr__(self):
|
|
return self.decimal
|
|
|
|
def __str__(self):
|
|
return self.decimal
|