Using a float field with configurable precision
When using float
fields, we may want to let the end user configure the decimal precision that is to be used. In this recipe, we will add a Cost Price
field to the Library Books
model, with the user-configurable decimal precision.
Getting ready
We will continue using the my_library
add-on module from the previous recipe.
How to do it...
Perform the following steps to apply dynamic decimal precision to the model's cost_price
field:
- Activate Developer Mode from the link in the Settings menu (refer to the Activating the Odoo developer tools recipe in Chapter 1, Installing the Odoo Development Environment). This will enable the Settings | Technical menu.
- Access the decimal precision configurations. To do this, open the Settings top menu and select Technical | Database Structure | Decimal Accuracy. We should see a list of the currently defined settings.
- Add a new configuration, setting Usage to
Book Price
, and...