Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
5 Odpowiedzi
11913 Widoki

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?


Awatar
Odrzuć
Autor Najlepsza odpowiedź

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'])"> 
Awatar
Odrzuć
Najlepsza odpowiedź

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

Awatar
Odrzuć

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

Najlepsza odpowiedź

I found the answer. It's working fine.

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

Awatar
Odrzuć
Najlepsza odpowiedź

In Odoo 11.0 it will be :

<span t-esc="'%.0f'% l.quantity "/>
Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
3
gru 24
4823
2
cze 23
4624
0
mar 22
2520
0
sie 21
5190
0
kwi 18
8672