Using a float field with configurable precision
When using float fields, we may want to let the end user configure the precision that is to be used. The Decimal Precision Configuration module addon provides this ability.
We will add a Cost Price field to the Library Book model, with a user-configurable number of digits.
Getting ready
We will reuse the my_module
addon module from Chapter 3, Creating Odoo Modules.
How to do it…
We need to install the decimal_precision
module, add a "Usage" entry for our configuration, and then use it in the model field:
Make sure the Decimal Accuracy module is installed; select Apps from the top menu, remove the default filter, search for the Decimal Precision Configuration app, and install it if it's not already installed:
Activate the Developer Mode in the About dialog box, available within the ? icon in the menu bar at the top. This will enable the Settings | Technical menu.
Access the Decimal Precision configurations. To do this, open the Settings top menu and...