← Back to team overview

c2c-oerpscenario team mailing list archive

[Bug 634634] Re: Searching on float fields does not work properly

 

Imprecision with floats is not to be considered as an issue, it's as
normal behaviour due to the single precision floating-point format used
in most modern programming languages. Allowing to specify a float as a
string (or most other improvements that come to mind when trying to find
a solution) is a feature that could be added to OpenERP but it would be
too hard to test for V6. So it will be for a future version.

-- 
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to the OpenERP Project Group.
https://bugs.launchpad.net/bugs/634634

Title:
  Searching on float fields does not work properly

Status in OpenObject Server:
  Confirmed

Bug description:
  Trying to search with [('float_field','=',3.28)] or [('float_field','=','3.28')] may not work correctly because OpenERP converts the value in the right into float before doing the search in the database. This is an issue because it means that one cannot relay on the search, even if the field in the database is NUMERIC instead of FLOAT. The reason is that the final query may end up being:

WHERE float_field = 3.2800012

which will not exist.

The attached patch, checks if field is of type float and allows [('float_field','=','3.28')] to be used and thus allow searching for exact numbers.