Pular para o conteúdo
Menu
Esta pergunta foi sinalizada
2 Respostas
6762 Visualizações

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
Cancelar
Autor Melhor resposta

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
Cancelar
Melhor resposta

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
Cancelar
Publicações relacionadas Respostas Visualizações Atividade
6
mai. 24
70821
1
nov. 22
14067
0
jul. 25
111
1
mai. 25
1157
1
mai. 25
1179