Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
3 ตอบกลับ
3702 มุมมอง

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

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
0
ธ.ค. 18
2699
3
ก.พ. 25
19275
1
ธ.ค. 22
3971
1
ต.ค. 22
2533
1
พ.ย. 18
3097