跳至内容
菜单
此问题已终结
1 回复
13438 查看

Hello Everyone...

In odoo 10 How to show Currency Symbol after custom field name my code is as below:

sum_insured = fields.Monetary(string='Sum Insured')

currency_id = fields.Many2one('res.currency', string='Currency', readonly=True, default=lambda self: self.env.user.company_id.currency_id)

AND XML IS AS FOLLOWS: -

<field name="sum_insured" widget='monetary' options="{'currency_field': 'currency_id'}"/>

But still No CURRENCY SYMBOL IS VISIBLE.

THANKS in advance


形象
丢弃
最佳答案

Hi AJAY KHANNA,

Try This Code.

Xml

<div>
<label for="sum_insured" class="oe_edit_only" />
<div class="o_row">
<field name="sum_insured" widget='monetary' options="{'currency_field': 'currency_id'}" readonly="False" />
</div>
</div>

Python

sum_insured = fields.Float(string='Sum Insured')

currency_id = fields.Many2one('res.currency', string='Currency',
default=lambda self: self.env.user.company_id.currency_id)

Thank you.

形象
丢弃
编写者

Hi Avinash,

This code is not working, I just want to show currency logo before field value like its in sales order amount_total field.Thanks

Hi Ajay Khanna,

This code is for the thing you mentioned in the comment.

I don't know why it is not working for you.

Please make sure that you don't miss any line from my code.(sum_insured field is type Float).

Thank you.

编写者

Hi Avinash,

Now it's resolved ,the field missing in your code is <field name="currency_id" invisible="1"/> before sum_insured field in xml .Anyway Thanks a lot For the help.

相关帖文 回复 查看 活动
1
11月 23
9353
2
7月 19
5215
2
3月 15
6314
1
9月 17
3470
1
3月 15
9217