← Back to team overview

c2c-oerpscenario team mailing list archive

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

 

@xrg,

may be a way to avoid side effects would be to define a new OpenERP float type that would allow differentiating Null/None.
Old float would still work the regular way, not breaking anything. Modules would be ported to the new float type as need arise.

@nicolas: I believe nobody here was talking about the float imprecision
(float vs decimal I guess)

-- 
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.





Follow ups