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

Hi Community,

I have a field in python having the value of 16788.145 when i put this on report template it displays as 16788.15.How can i solve this issue.I need 16788.14 in the report

Thanks in advance

Awatar
Odrzuć

How to stop auto rounding of float fields in odoo: https://goo.gl/groZgT

Najlepsza odpowiedź

Hi,

Try the following code


import math
custom_value = math.floor(16788.145 * 10 ** 2) / 10 ** 2

Regards


Awatar
Odrzuć
Najlepsza odpowiedź

Hi,

In the report template, you can give it like this t-options='{"widget": "float", "decimal_precision": "Product Unit of Measure"}' along with t-esc or span.

Sample:

<t t-esc="l['quantity']" t-options='{"widget": "float", "decimal_precision": "Product Unit of Measure"}'/>

You can change the decimal_precision accordingly.

Thanks

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
0
gru 18
2706
3
lut 25
19284
1
gru 22
3972
1
paź 22
2533
1
lis 18
3099