Skip to Content
Menu
This question has been flagged
2476 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:

./client/bin/widget/view/form_gtk/

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')

Avatar
Discard