Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
5 Trả lời
11978 Lượt xem

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?


Ảnh đại diện
Huỷ bỏ
Tác giả Câu trả lời hay nhất

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'])"> 
Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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

Ảnh đại diện
Huỷ bỏ

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

Câu trả lời hay nhất

I found the answer. It's working fine.

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

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

In Odoo 11.0 it will be :

<span t-esc="'%.0f'% l.quantity "/>
Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
3
thg 12 24
4893
2
thg 6 23
4711
0
thg 3 22
2563
0
thg 8 21
5235
0
thg 4 18
8728