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

Hi,

I want to change Unit of Measure to 1 instead of 1,000. I already dit this, but without result:

Enable UoM on Setting :

Setting > Configuration > Sales > Allow using different units of measure (check)


Create / Change Uom then "Rounding Precision" to 1.0 :

Purchase > Configuration > Products > Unit of Measure > [edit UoM] change field "Rounding Precision" to 1.0

الصورة الرمزية
إهمال

Do you want to change decimal precision of the Qty field or what?

أفضل إجابة

Note on Mike Donahue solution:
you need to remove the int() function in order to show the fraction itself not only zeros
so it should be <span t-esc="'{0:,.0f}'.format(o.product_qty)"/>

Thanks again for Mike Donahue!

الصورة الرمزية
إهمال
الكاتب أفضل إجابة

Zbik, thank you so much.

This did the trick: See master menu Settings: /Settings/Technical/Database Structure/Decimal Accuracy/Product Unit of Measure

It is really easy and works like a charm! Thanks to everybody for helping!

الصورة الرمزية
إهمال

Yes, this is also a good solutions, wherever "Unit of Measure" precision parameter will be passed it will reflect there. but if you just want to change sale price qty decimal precision then you have to inherit the model and need to update precision on digits parameter.

أفضل إجابة

I use this in my QWeb reports to show a quantity of 1:

Changes the decimal for UoM to no decimal.

<span t-esc="'{0:,.0f}'.format(int(o.product_qty))"/> 

0f is saying zero decimals.  1f would be one decimal place, etc.  I hope this points you in the right direction.

الصورة الرمزية
إهمال
أفضل إجابة

Hi Peter,

Yes, default qty is displayed with 3 decimals, like you said, 1.000,

If you want to display 1 only instead of 1.000 you need to set decimal precision on that field by using "digits" property of the field

E. g.

from odoo import fields, models
class SaleOrderLine(models.Model):
inherit = 'sale.order.line'
product_uom_qty = fields.Float(string='Quantity', digits=(16, 0), required=Truedefault=1)


digits =  (16,0) is value for your present need, you can give the value according to your need, you needed 1.0 change it to (16,1) if needed 1.00 then change it to (16,2).

Hope this would help you.

Rgds,

Anil

    

الصورة الرمزية
إهمال
أفضل إجابة

See master menu Settings: /Settings/Technical/Database Structure/Decimal Accuracy/Product Unit of Measure

الصورة الرمزية
إهمال
الكاتب

Perfect, this worked for me. Thank you!

المنشورات ذات الصلة الردود أدوات العرض النشاط
4
نوفمبر 24
8170
0
يوليو 25
732
2
يوليو 24
2671
1
يونيو 24
5138
1
أكتوبر 23
10848