This question has been flagged
1 Reply
11552 Views

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


Avatar
Discard
Best Answer

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.

Avatar
Discard
Author

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.

Author

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.