Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

Problem with ilike operator in openerp 7

By
vivek
on 5/23/13, 8:25 AM 2,716 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?

1
vivek
On 6/1/13, 1:49 AM

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'
0

Serpent Consulting Services Pvt. Ltd.

--Serpent Consulting Services Pvt. Ltd.--
4341
| 6 6 8
Gandhinagar, India
--Serpent Consulting Services Pvt. Ltd.--

Serpent Consulting Services Pvt. Ltd. Your Odoo/OpenERP Solution, just an email away!

Serpent Consulting Services Pvt. Ltd.
On 5/31/13, 12:31 PM

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.

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)

Stats

Asked: 5/23/13, 8:25 AM
Seen: 2716 times
Last updated: 3/16/15, 8:10 AM