[REF] expression: cosmetic changes.

bzr revid: vmt@openerp.com-20110726184806-j3nejlzo9ez5epb7
This commit is contained in:
Vo Minh Thu 2011-07-26 20:48:06 +02:00
parent 7315181412
commit 69eb057063
1 changed files with 51 additions and 46 deletions

View File

@ -502,33 +502,38 @@ class expression(object):
if check_nulls:
query = '(%s OR %s.%s IS NULL)' % (query, table._table, left)
else:
elif right == False and (left in table._columns) and table._columns[left]._type=="boolean" and (operator == '='):
query = '(%s.%s IS NULL or %s.%s = false )' % (table._table, left, table._table, left)
params = []
if right == False and (left in table._columns) and table._columns[left]._type=="boolean" and (operator == '='):
query = '(%s.%s IS NULL or %s.%s = false )' % (table._table, left, table._table, left)
elif (((right == False) and (type(right)==bool)) or (right is None)) and (operator == '='):
query = '%s.%s IS NULL ' % (table._table, left)
params = []
elif right == False and (left in table._columns) and table._columns[left]._type=="boolean" and (operator in ['<>', '!=']):
query = '(%s.%s IS NOT NULL and %s.%s != false)' % (table._table, left, table._table, left)
params = []
elif (((right == False) and (type(right)==bool)) or right is None) and (operator in ['<>', '!=']):
query = '%s.%s IS NOT NULL' % (table._table, left)
params = []
elif (operator == '=?'):
op = '='
if (right is False or right is None):
return ('TRUE', [])
if left in table._columns:
query = 'TRUE'
params = []
elif left in table._columns:
format = table._columns[left]._symbol_set[0]
query = '(%s.%s %s %s)' % (table._table, left, op, format)
query = '(%s.%s = %s)' % (table._table, left, format)
params = table._columns[left]._symbol_set[1](right)
else:
query = "(%s.%s %s '%%s')" % (table._table, left, op)
query = "(%s.%s = '%%s')" % (table._table, left)
params = right
else:
if left == 'id':
elif left == 'id':
query = '%s.id %s %%s' % (table._table, operator)
params = right
else:
like = operator in ('like', 'ilike', 'not like', 'not ilike')