Ir al contenido
Menú
Se marcó esta pregunta
2 Respuestas
6753 Vistas

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
Descartar
Autor Mejor respuesta

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
Descartar
Mejor respuesta

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
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
6
may 24
70802
1
nov 22
14049
1
may 25
1114
1
may 25
1149
2
mar 25
1107