How to change the number of decimal places in Odoo

In Odoo there is an option to change the number of decimal places for already defined decimal.precision objects: “Product Price“, “Discount“, “Stock Weight“, “Payment Terms“, “Product Unit of Measure“, “Payroll” and “Payroll Rate“.

You can do that by going to Settings >> Technical >> Database Structure >> Decimal Accuracy, choosing one of the defined objects and updating the field “Digits“.

Also, you can create a new decimal.precision object. In such a case you need to update the backend code with it.


    1. admin

      As I can see volume field in the product.template model does not have decimal precision defined, in such case you would need to override this field and do add decimal precision for it. It should look like this:

      volume = fields.Float(digits=dp.get_precision('Stock Volume'))

      Don’t forget to import decimal_precision

      from odoo.addons import decimal_precision as dp

      At the end defined in an XML file the definition of “Stock Volume” precision. Here is an example of other definitions.

Leave a Reply

Your email address will not be published. Required fields are marked *