Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
13441 Widoki

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


Awatar
Odrzuć
Najlepsza odpowiedź

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.

Awatar
Odrzuć
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.

Powiązane posty Odpowiedzi Widoki Czynność
1
lis 23
9357
2
lip 19
5218
2
mar 15
6314
1
wrz 17
3471
1
mar 15
9219