Using domain to limit what is displayed

In the Invoicing / Accounting app there is an option to view sales invoices.

The path is: Invoicing (or Accounting) / Accounting / Sales

This has two filters:

  1. Posted transactions
  2. Sales transactions

Note that filters can be removed, so it’s possible to see all transactions. But you might want to limit it to sales transactions so that users with access to this menu option can’t see other journals (e.g. bank, purchase).

This can be done by amending the domain on the Windows Action


The easiest way to find out what domain to use is by creating a filter. This is very easy to do.

In this case, there is already a standard filter, so we can use that.

This is now shown at the top of the screen (if you had created a filter the details would be shown, but in this case we used a standard filter):

Next we need to save this search

Give it a name and click on Save

It’s shown under “Favorites”

For more information you can enable “developer mode“, navigate to Technical / User-defined Filters and view the filter you created.

Click on the “Sales” filter

Click on “Edit”

Now we can see the domain:


Windows Action

The next step is to add this domain to the Windows Action.

You can click on the “bug” icon and “Edit Action”

or you can select from Settings / Technical / Windows Actions:

Both methods will take you to the Windows Action

Note that there is already a domain:

[('display_type', 'not in', ('line_section', 'line_note'))]

But it does NOT limit the type of transaction, so we can add the domain from the Filter we created above.


More information about domains

After making this change, the user cannot select any other types of journal from this menu option.

However, they may be able to view these other types from another menu option. So a Record Rule may be a more complete solution, but it also needs more testing because it affects the whole of Odoo. You can use the same domain.


This is the Context for the Windows Action:

     'search_default_group_by_move': 1,
     'expand': 1}

Question: what is 'journal_type':'sales' supposed to do?

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s