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:
@@ -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"
|
||||
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user