Windows Actions

Windows Action are an important element of the Odoo architecture.

They are primarily used with menus: each menu option is linked to a Windows Action (and in Odoo Studio, when you create a new menu an associated Windows Action will also be created).

Here’s one way to see how they are used:

Start by enabling developer mode and then click on the “bug” icon on the right-hand side and select “Edit Action” from the menu:

This will display the Windows Action

Windows Action for Quotations

As you will see, there is a lot of information for each Action (mandatory fields marked with *):

Basic information

Action Name* (which will be shown at the top of the screen)

External ID (allocated by Odoo)

Object*

  • Every Windows Action is for one Model (database table). In this example it is sale.order (Quotations and Sales Orders)

Action Usage (optional text field)

Action Type (ir.actions_act_window)

Target Window*

There are several options:

  • Current Window (open in the main content area) (default)
  • New Window (in a dialog/popup).
  • Inline Edit (only used in Technical Settings)
  • Full Screen (full screen mode)
  • Main Action of Current Window (Open in the main content area and clear the “breadcrumbs“).

Help

This text is displayed if there are no records to display in the List View. Some of these descriptions are not very helpful, so you might want to change them to something simpler and clearer (I prefer something like “No records to display” or “No orders to display”).

Note also that Odoo Studio defaults this to:

This is your new action; by default, it contains a list view and a form view.

You can start customizing these screens by clicking on the Studio icon on the top right corner (you can also customize this help message there).

This obviously needs to be changed!!

Views

View Mode*

This is a list of the Form Types that are available in this menu option – one or more, separated by commas. In the above example, seven view types have been selected.

  • tree
  • kanban
  • form
  • calendar
  • pivot
  • graph
  • activity

The available types can be seen in the top right corner of the screen:

6 view types are shown (Form View is not shown as an icon)

There are several other view types available (depending upon the version of Odoo).

View Ref.

The view to be used. This is optional: you can either specify a list of views (in the Views section) or simply use the default views for the Model.

Search View Ref

Select the Search View to be used.

Filters

Domain Value

Limits which records are displayed (more information)

This example selects sales invoices

Context Value

Context can be used to set defaults for new records (as in the above example) or to display inactive records or change the sort sequence.

Limit – specifies the number of records to display initially (default 80)

Auto Search (True / False)

Filter (True / False)

Restrict to Lists (True / False)

Special

These only applies to Actions that are available from the ‘Action Menu’ (e.g. “Merge Contacts”)

Binding Type

  • Action
  • Form-only
  • Report

Binding Model

  • Specify the model (database table)

Views

This is optional, and can be used to override which Views will be used for this action. Below is one example where it is used:

No Form View is specified, so the standard one will be used.

Note that the available views are specified in View Mode

Security

It’s possible to restrict a Windows Action to selected User Access Groups, though this is not used very often (instead, access is usually controlled through the menu).

One example is that “Create a Sales Order” in the Project app is only available to Sales Users:

This makes sense, because if a user doesn’t have this authority they should not be able to create a sales order. Note that this action is not called directly from a menu, which is why security is added here.

Leave a comment