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

Write a wizard to guide the user


In the Use Abstract Models for reusable Model features recipe in Chapter 4, Application Models, the base class models.TransientModel was introduced; this class shares a lot with normal Models except that the records of transient models are periodically cleaned up in the database, hence the name transient. These are used to create wizards or dialog boxes, which are filled in the user interface by the users and generally used to perform actions on the persistent records of the database.

This recipe extends the code from Chapter 3, Creating Odoo Modules by creating a wizard to record the borrowing of books by a library member.

Getting ready

If you want to follow the recipe, make sure you have the my_module addon module from Chapter 3, Creating Odoo Modules.

We will also use a simple model to record book loans:

class LibraryBookLoan(models.Model):
    _name = 'library.book.loan'
    book_id = fields.Many2one('library.book', 'Book',
                              required...