res_ids = self.search(cr, uid, [('company_id.partner_id', 'not in', [])])
res_ids.sort()
assert res_ids == all_ids, "Searching against empty set failed, returns %r" % res_ids
+-
+ Check that we can exclude translated fields (bug lp:1071710)
+-
+ !python {model: res.country}: |
+ # first install french language
+ BLI = self.pool.get('base.language.install')
+ BLI.lang_install(cr, uid, [BLI.create(cr, uid, {'lang': 'fr_FR'})])
+
+ be_id = self.search(cr, uid, [('name', '=', 'Belgium')])[0]
+
+ ctx = {'lang': 'fr_FR'}
+ not_be = self.search(cr, uid, [('name', '!=', 'Belgique')], context=ctx)
+ assert be_id not in not_be, "Search match failed"
def _is_leaf(self, element, internal=False):
OPS = ('=', '!=', '<>', '<=', '<', '>', '>=', '=?', '=like', '=ilike', 'like', 'not like', 'ilike', 'not ilike', 'in', 'not in', 'child_of')
- INTERNAL_OPS = OPS + ('inselect',)
+ INTERNAL_OPS = OPS + ('inselect', 'not inselect')
return (isinstance(element, tuple) or isinstance(element, list)) \
and len(element) == 3 \
and (((not internal) and element[1] in OPS) \
operator = operator == '=like' and 'like' or operator
+ new_op = 'inselect'
+ if operator in ['not like', 'not ilike', 'not in', '<>', '!=']:
+ new_op = 'not inselect'
+ operator = {'not like': 'like', 'not ilike': 'ilike', 'not in': 'in', '<>': '=', '!=': '='}[operator]
+
query1 = '( SELECT res_id' \
' FROM ir_translation' \
' WHERE name = %s' \
' AND type = %s'
instr = ' %s'
#Covering in,not in operators with operands (%s,%s) ,etc.
- if operator in ['in','not in']:
+ if operator == 'in':
instr = ','.join(['%s'] * len(right))
query1 += ' AND value ' + operator + ' ' +" (" + instr + ")" \
') UNION (' \
right,
]
- self.__exp[i] = ('id', 'inselect', (query1, query2))
+ self.__exp[i] = ('id', new_op, (query1, query2))
return self
if operator == 'inselect':
query = '(%s.%s in (%s))' % (table._table, left, right[0])
params = right[1]
+ elif operator == 'not inselect':
+ query = '(%s.%s not in (%s))' % (table._table, left, right[0])
+ params = right[1]
elif operator in ['in', 'not in']:
params = right and right[:] or []
len_before = len(params)