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

I would like to use the following field in PDF invoice report:

<span t-field="l.quantity">

which displays the quantity.

In our particular deployment there is only integer values for quantities. How can I display quantities using without displaying decimal places?


อวตาร
ละทิ้ง
ผู้เขียน คำตอบที่ดีที่สุด

I found the answer somewhere on the internet. I do not know if this is documented somewhere or not:

<span  t-esc="int(l['quantity'])"> 
อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

There is a much easier way to change this in Odoo 8.

Go to Settings -> Technical -> Decimal Accuracy -> Product UoS (aka Product Quantity) -> *Change Digits to 0

This solution also pulls through to reports/PDF

อวตาร
ละทิ้ง

I agree. Much better to do it in Odoo config which will pull through the entire system.

คำตอบที่ดีที่สุด

I found the answer. It's working fine.

<span t-esc="'%.0f'%(l.quantity)"/>

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

In Odoo 11.0 it will be :

<span t-esc="'%.0f'% l.quantity "/>
อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
3
ธ.ค. 24
4823
Expect singleton: res.currency[SOLVED] แก้ไขแล้ว
2
มิ.ย. 23
4627
0
มี.ค. 22
2520
0
ส.ค. 21
5190
0
เม.ย. 18
8672