Adding a menu item and window action

The most obvious way to make a new feature available to the users is by using a menu item. When you click on a menu item, something happens. This recipe walks you through how to define that something.

We will create a top level menu displaying a sub menu in the left hand menu bar, opening a list of all the customers.

This can also be done using the web user interface, via the settings menu, but we prefer to use XML data files since this is what we'll have to use when creating our addon modules.

How to do it...

In an XML data file of our addon module, perform the following steps:

  1. Define an action to be executed:
    <act_window id="action_all_customers"
                name="All customers"
                res_model="res.partner"
     view_mode="tree,form" ...

Get Odoo Development Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.