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

Adding Menu Items and Views


Once we have Models for our data structure needs, we want a user interface for our users to interact with them. This recipe builds on the Library Book Model from the previous recipe and adds a menu item to display a user interface featuring list and form Views.

Getting ready

The addon module implementing the library.book Model, provided in the previous recipe, is needed. The paths used are relative to our addon module location (for example, ~/odoo-dev/local-addons/my_module/).

How to do it…

To add a view, we will add an XML file with its definition to the module. Since it is a new Model, we must also add a menu option for the user to be able to access it.

Be aware that the sequence of the following steps is relevant, since some use references to IDs defined in previous steps:

  1. Create the XML file to add the data records describing the user interface views/library_book.xml:

    <?xml version="1.0" encoding="utf-8"?>
    <openerp>
      <data>
        <!-- Data records...