add yml test-case for =like and =ilike operator

lp bug: https://launchpad.net/bugs/788106 fixed

bzr revid: nco@tinyerp.com-20110610133658-z4avh4z60moecyde
This commit is contained in:
Nimesh (Open ERP)
2011-06-10 19:06:58 +05:30
parent e1e0860f1d
commit 694693905a
2 changed files with 30 additions and 4 deletions
@@ -111,3 +111,29 @@
res_ids.sort()
assert res_ids == all_ids, "Searching against empty set failed, returns %r" % res_ids
-
Check that =like expressions is working without translation field
-
!python {model: res.partner }: |
all_ids = self.search(cr, uid, [('name', '=like', 'Ax')])
assert len(all_ids) <= 1,"with =like operator without translation field, returns"
-
Check that =ilike expression is working without translation field
-
!python {model: res.partner }: |
all_ids = self.search(cr, uid, [('name', '=ilike', 'Ax')])
assert len(all_ids) <= 2,"with =ilike operator without translation field, returns"
-
Check that =like expression is working with translation field
-
!python {model: res.country }: |
all_ids = self.search(cr, uid, [('name', '=like', 'Ind')])
assert len(all_ids) <= 3,"with =like operator with translation field, returns"
-
Check that =ilike expression is working with translation field
-
!python {model: res.country }: |
all_ids = self.search(cr, uid, [('name', '=ilike', 'Ind')])
assert len(all_ids) <= 3,"with =ilike operator with translation field, returns"
+4 -4
View File
@@ -353,11 +353,10 @@ class expression(object):
self.__exp[i] = tuple(self.__exp[i])
if field.translate:
operator = {'=like':'like','=ilike':'ilike'}.get(operator,operator)
if operator in ('like', 'ilike', 'not like', 'not ilike'):
right = '%%%s%%' % right
operator = operator == '=like' and 'like' or operator
query1 = '( SELECT res_id' \
' FROM ir_translation' \
' WHERE name = %s' \
@@ -451,8 +450,9 @@ class expression(object):
query = '%s.id %s %%s' % (table._table, operator)
params = right
else:
operator = {'=like':'like','=ilike':'ilike'}.get(operator,operator)
like = operator in ('like', 'ilike', 'not like', 'not ilike')
op = {'=like':'like','=ilike':'ilike'}.get(operator,operator)
if left in table._columns:
format = like and '%s' or table._columns[left]._symbol_set[0]