Odoo Help


This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


How to define a secondary decimal accuracy for UOM? [Closed]

Ahmet Altinisik
on 2/12/13, 6:41 PM 2,831 views

The Question has been closed

Sudhir Arya (SA)
on 05/02/2013 04:21:58

We are using decimal accuracy 3 for UOM for UOMs like kg, Now every UOM is shown as 10.000 in OpenERP and this leads to confusions in UOM like PCE.

Is there a way to show PCE UOM as just 10 and Kg as 10.321 at the same time in openerp ?

Daniel Stenlöv
On 2/14/13, 9:01 AM

The above statement is correct for changing the number of decimals for all UOM.

However if you wish to remove the decimals for a specific UOM, like PCE. This can be accomplished by modify the report motor and the report, in this case the invoice.

First modify file openerp/report/report_sxw.py

Change header in class rml_parse def formatLang to:

   def formatLang(self, value, digits=None, date=False, date_time=False, grouping=True, monetary=False, dp=False, currency_obj=False, rstrip=False):

Add at the end before return res in class rml_parse def formatLang:

        if rstrip:

In the invoice report:


[[ formatLang(l.quantity)]]


[[ formatLang(l.quantity, rstrip=True) ]]

This will remove the right ending "0" and the ".".

Example the 10.000 PCE will become 10 PCE and 1.200 kg will become 1.2 kg on the report.

Two thumbs up :), Can we make a similar trick for displaying on web page?

Altınkaya Elektronik Cihaz Kutuları imalat Ticaret ltd sti, Ahmet Altinisik
on 2/14/13, 4:02 PM

Yes. it's possible. I will post the code when I get back to the office.

Daniel Stenlöv
on 2/15/13, 2:23 AM
On 2/14/13, 4:23 AM

It's not possible with standart options of OpenERP.

This option is possible only for all UOM.

  1. Install module decimal_precision.
  2. Check checkbox Technical Features in Settings / Users / Users page Access Rights.
  3. Go to Settings / Technical / Database Structure / Decimal Accuracy, open Product Unit of Measure and change the field Digits to your needs.

When I do such a change all of the UOM are affected. I want to have different setting for PCE since there is no decimals in PCE and 3 in Kg.

Altınkaya Elektronik Cihaz Kutuları imalat Ticaret ltd sti, Ahmet Altinisik
on 2/14/13, 4:33 AM

then I answered it earlier - you can configure this option only for all UOM.

on 2/14/13, 4:38 AM

Maybe my question was nor clear enough. I want to define a secondary decimal accuracy for different UOM.

Altınkaya Elektronik Cihaz Kutuları imalat Ticaret ltd sti, Ahmet Altinisik
on 2/14/13, 4:55 AM

I think it's not possible with standard OpenERP options.

on 2/14/13, 5:24 AM
On 2/13/13, 3:16 AM

I think there is only one configuration opportunity for all UOM.

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)


Asked: 2/12/13, 6:41 PM
Seen: 2831 times
Last updated: 3/16/15, 8:10 AM