Siirry sisältöön
Menu
Sinun on rekisteröidyttävä, jotta voit olla vuorovaikutuksessa yhteisön kanssa.
Tämä kysymys on merkitty
5 Vastaukset
11980 Näkymät

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
Hylkää
Tekijä Paras vastaus

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
Hylkää
Paras vastaus

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

Avatar
Hylkää

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

Paras vastaus

I found the answer. It's working fine.

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

Avatar
Hylkää
Paras vastaus

In Odoo 11.0 it will be :

<span t-esc="'%.0f'% l.quantity "/>
Avatar
Hylkää
Aiheeseen liittyviä artikkeleita Vastaukset Näkymät Toimenpide
3
jouluk. 24
4897
2
kesäk. 23
4714
0
maalisk. 22
2563
0
elok. 21
5236
0
huhtik. 18
8735