O'Reilly logo

Odoo Development Cookbook by Daniel Reis, Alexandre Fayolle, Holger Brunn

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Defining filters on record lists: Domain

We've already seen the first example of a domain in the first action, which was [('customer', '=', True)]. It is a very common use case when you need to display a subset of all available records from an action, or to allow only a subset of possible records to be the target of a many2one relation. The way to describe these filters in Odoo is called a domain. This recipe illustrates how to use such a domain to display a selection of partners.

How to do it...

To display a subset of partners from your action, you need to perform the following steps:

  1. Add an action for non-French speaking customers:
    <record id="action_my_customers" model="ir.actions.act_window"> <field name="name"> All customers who don't speak French ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required