Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odpovědět
13768 Zobrazení

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.

Avatar
Zrušit
Nejlepší odpověď

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.

Avatar
Zrušit

Thanks for that tip!

Related Posts Odpovědi Zobrazení Aktivita
2
lis 23
3171
7
dub 21
20543
1
říj 20
4920
2
lis 16
4275
4
bře 15
21166