Help

3

Display a quantity in PDF reports without decimal places (we are always dealing with integer numbers)

Avatar
E.M.

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?


Avatar
Discard
4 Answers
4
Avatar
E.M.
Best Answer

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'])"> 
Avatar
Discard
5
Avatar
Jessica Dowd
Best Answer

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

1 Comment
Avatar
Discard
Avatar
Andre de Kock
-

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

2
Avatar
Jaydeep Barot (jar)
Best Answer

I found the answer. It's working fine.

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

Avatar
Discard
0
Avatar
Jordy Blankestijn
Best Answer

In Odoo 11.0 it will be :

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