[FIX] osv: fix boolean in domain for custom field
When a new column has been added after that some data already exists,
the old lines will keep an empty/null value. So when we search is the new field
is equals to False or if it is different of True, we need to match the null
values.
Backport of de3b64018a
This commit is contained in:
parent
cc82f7518f
commit
3a1c693259
|
@ -1149,7 +1149,7 @@ class expression(object):
|
||||||
else: # Must not happen
|
else: # Must not happen
|
||||||
raise ValueError("Invalid domain term %r" % (leaf,))
|
raise ValueError("Invalid domain term %r" % (leaf,))
|
||||||
|
|
||||||
elif right == False and (left in model._columns) and model._columns[left]._type == "boolean" and (operator == '='):
|
elif (left in model._columns) and model._columns[left]._type == "boolean" and ((operator == '=' and right is False) or (operator == '!=' and right is True)):
|
||||||
query = '(%s."%s" IS NULL or %s."%s" = false )' % (table_alias, left, table_alias, left)
|
query = '(%s."%s" IS NULL or %s."%s" = false )' % (table_alias, left, table_alias, left)
|
||||||
params = []
|
params = []
|
||||||
|
|
||||||
|
@ -1157,7 +1157,8 @@ class expression(object):
|
||||||
query = '%s."%s" IS NULL ' % (table_alias, left)
|
query = '%s."%s" IS NULL ' % (table_alias, left)
|
||||||
params = []
|
params = []
|
||||||
|
|
||||||
elif right == False and (left in model._columns) and model._columns[left]._type == "boolean" and (operator == '!='):
|
elif (left in model._columns) and model._columns[left]._type == "boolean" and ((operator == '!=' and right is False) or (operator == '==' and right is True)):
|
||||||
|
|
||||||
query = '(%s."%s" IS NOT NULL and %s."%s" != false)' % (table_alias, left, table_alias, left)
|
query = '(%s."%s" IS NOT NULL and %s."%s" != false)' % (table_alias, left, table_alias, left)
|
||||||
params = []
|
params = []
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue