跳至內容
選單
此問題已被標幟
1 回覆
1946 瀏覽次數

i m facing an issue ,in which i have list of name (list of values) i need to pattern match with (ilike) condition to match contains name with list of values.

this take 'IN' as argument in domain search:

[('payment_ref','in', tuple(label_data.mapped('name')))]

but i need to match with contains name(ilike) condition with label_data.mapped('name')

how can i do that.

list = ['abc','def']

matching should be 'xxabcyy', 'aadef' should match.

頭像
捨棄
最佳答案

Hi,

You can use the '|' operator in the domain to combine multiple ilike conditions. Here's an example of how you can modify your domain search:


domain=[]

for name in list_of_names:

    domain.extend(['|', ('name', 'ilike', name)])

domain.pop(-2)


Hope it helps

頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
1
11月 23
1616
1
5月 23
2407
2
3月 24
1649
1
11月 23
2024
4
11月 23
2777