コンテンツへスキップ
メニュー
この質問にフラグが付けられました
1 返信
33422 ビュー

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?

アバター
破棄
最善の回答

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, Its 'currency_field' and not 'currency'. check web/addons/web/static/src/js/view_form.js at line 5452 the instance.web.form.FieldMonetary

著作者

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

関連投稿 返信 ビュー 活動
1
3月 15
9225
2
2月 24
8157
0
9月 17
8156
1
5月 17
4452
0
6月 21
4240