跳至内容
菜单
此问题已终结
3 回复
3714 查看

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

形象
丢弃

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

最佳答案

Hi,

Try the following code


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

Regards


形象
丢弃
最佳答案

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

形象
丢弃
相关帖文 回复 查看 活动
0
12月 18
2711
3
2月 25
19289
1
12月 22
3975
1
10月 22
2533
1
11月 18
3100