Skip to Content
Menu
This question has been flagged
2 Replies
6757 Views

Hi,

i know operator ilike already with regard to sql. It will perform this way when placing in where class

 'PSS01' ilike 'pss01' -> will return true
 'PSS01' ilike '%ss01' -> will return true
 'PSS01' ilike 'ss01' -> will return false

But in openerp 7, it performs this way

 'PSS01' ilike 'pss01' -> returns true
 'PSS01' ilike 'ss01' -> returns true **(it should return false)**

My code is below

 repeted_ids = prod_serial_obj.search(cr, uid, ['&',('name', 'ilike', line.prod_ser_no),('product_id', '=', product_id)])

Can anyone help with this?

Avatar
Discard
Author Best Answer

More descriptive answer i got from another source..

OpenERP automatically wraps the right handed value of ilike operator inside percents. So when you write the domain

[('name', 'ilike', 'ss01')]

OpenERP convert it to

name ilike '%ss01%'

To avoid having these wildcard characters added, you have to use the =ilike operator.

[('name', '=ilike', 'ss01')]

will be converted to

name ilike 'ss01'
Avatar
Discard
Best Answer

Hello,

OpenERP automatically wraps the right handed value of ilike operator inside percents. So when you write the domain [('name','ilike','ss01')]

OpenERP convert it to [('name','ilike','%ss01%')]

To avoid having these wildcard characters added, you have to use the =ilike operator. [('name', '=ilike', 'ss01')]

Hope this will help.

Thank you.

Avatar
Discard
Related Posts Replies Views Activity
6
May 24
70815
1
Nov 22
14059
1
May 25
1152
1
May 25
1175
2
Mar 25
1122