Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
6909 มุมมอง

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?

อวตาร
ละทิ้ง
ผู้เขียน คำตอบที่ดีที่สุด

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'
อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

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.

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
6
พ.ค. 24
71107
1
พ.ย. 22
14239
0
ก.ค. 25
884
Filters in multiple companies แก้ไขแล้ว
1
พ.ค. 25
1604
ADD PROPERTIES แก้ไขแล้ว
1
พ.ค. 25
2610