تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
5 الردود
12001 أدوات العرض

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
ديسمبر 24
5025
2
يونيو 23
4814
0
مارس 22
2600
0
أغسطس 21
5306
0
أبريل 18
8802