콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
1 회신
33676 화면

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
9381
2
2월 24
8321
0
9월 17
8333
1
5월 17
4630
0
6월 21
4494