Skip to Content
Menu
This question has been flagged
1 Reply
16130 Views

Dear All,


I created a new custom float field in timesheet app with a simple calculation. 

It works fine except the rounding, that is set on 2 decimal by default.

So I wanted to increase to 3 the decimal accuracy by "Settings -> Technical -> Decimal Accuracy" but I have no idea how to identify my custom field. I tried in different ways:


- by Technical Name -> "x_studio_my field"

- just by name -> "my field"

- by field label


Nothing works. 

Can you please suggest how to achieve this simple goal?


thanks

Igor



Avatar
Discard
Best Answer

UPDATE: Based on Tim's additional question, you can also do:


digits="Stock Weight"


You can use any of the Decimal Accuracy records:


.. or can create your own and use that.

-------------------------------------------------------------------------------

Have you tried the digits tag in the XML declaring where your field is shown?

We use this to display the float field for currency exchange rates:

https://github.com/odoo/odoo/blob/13.0/odoo/addons/base/views/res_currency_views.xml#L20

 <field name="rate" digits="[12,12]"/>
Avatar
Discard

Thank you for this Ray, works great in V14 for me. I'm curious if there is a way to reference a record in the model decimal.precision ? I needed a float field for recording dimensions and I can see that being needed again.

See my updated answer.

Outstanding, thank you!

What if the decimal accuracy is different in a multi-company environment for the same currency? Any way to setup by company?

This would require customization - we don't support multiple decimal accuracy values - just one per database. You could create as many as you wanted but you would need to redefine the fields (in Python) that reference them.