Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
14422 Lượt xem

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

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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:


Ảnh đại diện
Huỷ bỏ
Tác giả Câu trả lời hay nhất

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)
Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 5 23
8872
1
thg 4 22
1819
1
thg 8 21
11177
0
thg 6 21
2679
1
thg 4 20
3668