Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
5 Risposte
11923 Visualizzazioni

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
Abbandona
Autore Risposta migliore

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
Abbandona
Risposta migliore

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
Abbandona

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

Risposta migliore

I found the answer. It's working fine.

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

Avatar
Abbandona
Risposta migliore

In Odoo 11.0 it will be :

<span t-esc="'%.0f'% l.quantity "/>
Avatar
Abbandona
Post correlati Risposte Visualizzazioni Attività
3
dic 24
4826
2
giu 23
4638
0
mar 22
2523
0
ago 21
5194
0
apr 18
8675