Book Image

Odoo Development Cookbook

By : Holger Brunn, Alexandre Fayolle, Daniel Reis
Book Image

Odoo Development Cookbook

By: Holger Brunn, Alexandre Fayolle, Daniel Reis

Overview of this book

Odoo is a full-featured open source ERP with a focus on extensibility. The flexibility and sustainability of open source is also a key selling point of Odoo. It is built on a powerful framework for rapid application development, both for back-end applications and front-end websites. The book starts by covering Odoo installation and administration, and provides a gentle introduction to application development. It then dives deep into several of the areas that an experienced developer will need to use. You’ll learn implement business logic, adapt the UI, and extend existing features.
Table of Contents (23 chapters)
Odoo Development Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

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:

  1. 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:

  2. 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.

  3. Access the Decimal Precision configurations. To do this, open the Settings top menu and...