Window actions

A window action gives instructions to the GUI client and is usually used by menu items or buttons in views. It tells the GUI what model to work on, and what views to make available. These actions can filter the records to be available, using a domain filter, and can set default values and filters through the context attribute.

We will add window actions to the views/todo_menu.xml data file, which will be used by the menu items created in the previous section. Edit the file, and make sure they are added before the menu items:

<!-- Actions for the menu items --> 
<act_window id="action_todo_stage" name="To-Do Task Stages" res_model="todo.task.stage" view_mode="tree,form" target="current" context="{'default_state': 'open'}" domain="[]" ...

Get Odoo 11 Development Essentials - Third Edition 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.