تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
1 الرد
32773 أدوات العرض

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
مارس 15
8757
2
فبراير 24
7655
0
سبتمبر 17
7775
1
مايو 17
3972
0
يونيو 21
3835