Ir al contenido
Menú
Se marcó esta pregunta
1 Responder
13440 Vistas

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
Descartar
Mejor respuesta

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
Descartar
Autor

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.

Autor

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.

Publicaciones relacionadas Respuestas Vistas Actividad
1
nov 23
9354
2
jul 19
5215
2
mar 15
6314
1
sept 17
3471
1
mar 15
9217