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

Monetary widget within form

By
Martin Ambroz
on 4/22/13, 3:41 AM 5,103 views

Dear All,

I am trying to display currency symbol within form view, so far I tried these:

<field name="agent_price" widget='monetary' options="{'currency': %(base.EUR)d}" string="Agent Price" />
<field name="agent_price" widget='monetary' options="{'currency': [%(base.EUR)d]}" string="Agent Price" />

The following:

%(base.EUR)d

is translated properly to id, but nothing seems to be working (nothing is displayed nor any error shown, it even seems that the widget attribute is completely ignored). Maybe I am missing something?

2

Naresh Soni (nch)

--Naresh Soni (nch)--
Tiny ERP Pvt Ltd
http://www.odoo.com
1281
| 2 2 4
India
--Naresh Soni (nch)--

Team Lead, Odoo(Formerly OpenERP) Support & OPW

Naresh Soni (nch)
On 4/22/13, 4:01 AM

Hi Martin,

Try this:

<field name="agent_price" widget='monetary' options="{'currency_field': 'currency_id'}" string="Agent Price"/>

Thanks,

Unfortunately this is not the way, you are using another field to determine the currency_id, if you read javascript code of MonetaryField widget, you can see clearly there is option named 'currency' where you can specify the currency value, the real problem is this time somewhere else :/

Martin Ambroz
on 4/22/13, 7:14 AM

Martin, Its 'currency_field' and not 'currency'. check web/addons/web/static/src/js/view_form.js at line 5452 the instance.web.form.FieldMonetary

Naresh Soni (nch)
on 4/22/13, 8:37 AM

I've just checked, it resets the 'currency' to false :-/ I assumed the whole time that it sets false default value ;-)

Martin Ambroz
on 4/22/13, 9:00 AM

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

1 follower(s)

Stats

Asked: 4/22/13, 3:41 AM
Seen: 5103 times
Last updated: 3/16/15, 8:10 AM