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

How to adapt monetary widget ?

By
leo
on 12/10/13, 3:27 PM 1,581 views

Hello,

I'm trying to display monetary fields like this : '525200.52' => '525 000,52' in form views

I understood that I have to modify the following file addons/web/static/src/js/view_forms.js . And I allready managed to display the correct value modifying the 'format_value' line 5483

return instance.web.format_value(val.toLocaleString('fr-FR'), {type: "string", digits: (this.node.attrs || {}).digits || this.field.digits}, def);

However, since the field is now a String, when I try to edit and save I get an error :

TypeError: a float is required

Which is normal.

I looked at the parse_value function but didn't manage to solve my issue...

What do I need to modify next to achieve my goal ?

1
medhabib
On 12/12/13, 3:53 AM

you can see this link :http://help.openerp.com/question/88/how-to-define-the-thousands-separator/

Perfect, just what I needed ! Thank you.

leo
on 12/12/13, 8:22 PM

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: 12/10/13, 3:27 PM
Seen: 1581 times
Last updated: 3/16/15, 8:10 AM