Odoo Help

0

How to filter on a list of values ?

By
Sylvain RAUCY
on 5/11/17, 5:45 PM 479 views

I'm a user of Odoo 9.0 and I manage a list of 5000 people.

In the list view I have a search box on top, and I would like to perform a search that would give me people whose ID is in a specific list of values. For instance, I'd like to get people number 3, 4, 8, 12, 15, 18, 22, 321, 432, 923, 945, 971, 1434 and 3942.

In SQL it would be something like select * from people where ID in (3, 4, 8, 12, 15, 18, 22, 321, 432, 923, 945, 971, 1434, 3942).

I've looked in the filters where I can add a user-defined filter but it only allows me to filter on 1 specific value, or exclude 1 value, or even return people whose ID < or > to 1 specific value. Not what I'm looking for.

I'd be very grateful if you could help.

Sylvain

1
Ray Carnes
On 5/11/17, 6:00 PM

The trick is to modify the search view so that ID is searchable without needing a Custom Filter.  

You can add the ID field to the search view, or combine it with the default (first) search view field.

Adding this to the top of the search view would make ID the default search field:

<field name="id" filter_domain="[('id','=',self)]"/>

Then, enter all of the numbers:


0
Sylvain RAUCY
On 5/12/17, 3:12 AM

Hi Ray,

Thanks for the prompt answer.

I'm just a Odoo user, I'm not an admin and therefore I can't add the field you're mentioning.

Here's what I have :

Search field on top of my "membres" list :

<img src="http://raucy.free.fr/images/cap0.jpg" />

I can search 1 ID (the field to search in is "Base du barre code" which translate as "bar code base" and is an int)

<img src="http://raucy.free.fr/images/cap3.jpg" />

But if I try to enter 2 IDs like that with a "or" (which is a string), the "Base du barre code" option disapears :

<img src="http://raucy.free.fr/images/cap2.jpg" />

I tried to check if I'd search on names :

<img src="http://raucy.free.fr/images/cap2.jpg" />

But nothing comes  out this way :

<img src="http://raucy.free.fr/images/cap5.jpg" />

And finaly, in the user-defined filters, I can't type "or" in an int field :

<img src="http://raucy.free.fr/images/cap4.jpg">


(sorry I couldn't find how to insert images)

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

Asked: 5/11/17, 5:45 PM
Seen: 479 times
Last updated: 5/12/17, 3:12 AM