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

Hi

how to add search multiple of three field

this  code is working

<field name="street"    filter_domain="['|',('street','ilike',self),('city','ilike',self) string="Rue" />

but when i add field street2 to this code is not working

<field name="street"    filter_domain="['|',('street','ilike',self),('city','ilike',self),('street2','ilike',self)]" string="Rue" />

 

Thanks

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

For setting a domain in Odoo, It is a common terminology to use

AND CONDITION: domain = [('street','ilike',self),('city','ilike',self)]

OR CONDITION: domain = ['|',('street','ilike',self),('city','ilike',self)]

So, use this condition for your case:

<field name="street"    filter_domain="['|',  '|', ('street','ilike',self),('city','ilike',self),('street2','ilike',self)]" string="Rue" />

I have a added an "OR condition" in the filter_domain, so that you can search in either street, city or street2.

 

Ảnh đại diện
Huỷ bỏ
Tác giả

Thank you it works