跳至內容
選單
此問題已被標幟
5 回覆
11912 瀏覽次數

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 "/>
頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
3
12月 24
4822
2
6月 23
4622
0
3月 22
2519
0
8月 21
5190
0
4月 18
8671