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

Hi,

I know that the below are supported operators by openerp7.

  =, !=, >, >=, <, <=, like, ilike, in, not in, child_of, parent_left, parent_right

I would like to implement startswith and endswith search in openerp. Ex

AB* (starts with AB)
*AB (Ends with AB)

Is there a way to do it with the openerp framework itself without executing them as sql statements with cr.execute(). Specifically i would like to do that in global filter.

Thanks for your insights.

頭像
捨棄
最佳答案

Use '=like' and '=ilike' operators.

starts with AB is [('field','=like','AB%')]

ends with AB is [('field','=like','%AB')]

Use ilike for case insensitive match.

like and ilike operators (without '=') automatically add wildcard before and after search value.

頭像
捨棄

Thanks for that tip!

相關帖文 回覆 瀏覽次數 活動
2
11月 23
3296
7
4月 21
20748
1
10月 20
5033
2
11月 16
4373
4
3月 15
21242