跳至內容
選單
此問題已被標幟
1 回覆
13447 瀏覽次數

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
9364
2
7月 19
5225
2
3月 15
6316
1
9月 17
3473
1
3月 15
9223