Odoo Help

Welcome!

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

0

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

By
Juan Marquez
on 5/22/13, 12:28 PM 534 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')

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)

Stats

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