Odoo Help


Where I can find the code for float fields in 6.04 gtk client?

Juan Marquez
on 5/22/13, 12:28 PM 819 views

I need to force a '.' char in decimal fields to ',' (our decimal separator) I report this bug many months ago and it is solved on 6.1 & 7.0 but we still use 6.0.4

All users have problems when type float values and press the decimal key [.] in decimal keyboard. They type 100.00 and the amount 10000.00 is showed.

I think, if I can found the code where the float field's widget is implemented. I can "force" the change the decimal separator from '.' to ',' and solve this problem.

Adding something like this:

float_value = float(string_data.replace('.',','))

But I can found where is the code.

Note: I found some widgets in:


but none appears to be the float field widget

PD Sorry for my spelling

PD2 on 05/28/2013 I found in spimbutton.py:

    def format_input(self, spin, new_value_pointer):
        text = spin.get_text()
        ######## Added to "force" '.' as ',' for numeric dor convertion
        if not (',' in text) and ('.' in text):
            text = text.replace('.',',')
        ######## End -    
        if text:
            value = user_locale_format.str2float(text)
            value_location = ctypes.c_double.from_address(hash(new_value_pointer))
            value_location.value = float(value)
            return True
        return False

It Works! but the real solution need to use: LOCALE_CACHE.get('thousands_sep') & LOCALE_CACHE.get('decimal_point')

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

0 follower(s)


Asked: 5/22/13, 12:28 PM
Seen: 819 times
Last updated: 3/16/15, 8:10 AM