[FIX] It is possible to mention an undeclared column in a domain.
Actually, this seems to be used for the logging columns which are in database but not necessarily in _columns. This is ugly and a warning is now issued. lp bug: https://launchpad.net/bugs/857105 fixed bzr revid: vmt@openerp.com-20110923101839-ko0s7ekt4dlyvrx2
This commit is contained in:
parent
2c2367e551
commit
0c123711c5
|
@ -466,3 +466,9 @@
|
|||
assert len(all_ids) == 1, "Must match India only, got %r"%all_ids
|
||||
all_ids = self.search(cr, uid, [('name', '=ilike', 'z%')])
|
||||
assert len(all_ids) == 3, "Must match only countries with names starting with Z (currently 3), got %r"%all_ids
|
||||
-
|
||||
Use the create_date column on res.country (which doesn't declare it in _columns).
|
||||
-
|
||||
!python {model: res.country }: |
|
||||
ids = self.search(cr, uid, [('create_date', '<', '2001-01-01 12:00:00')])
|
||||
-
|
||||
|
|
|
@ -750,6 +750,10 @@ class expression(object):
|
|||
else:
|
||||
query = '(%s."%s" %s %s)' % (table._table, left, sql_operator, format)
|
||||
else:
|
||||
# Ugly case to support columns present in database but not in
|
||||
# _columns. This will probably be removed in the future, but
|
||||
# we have to keep it for now.
|
||||
_logger.warning("The domain term '%s' specify a column not declared in _columns." % ((left, operator, right),))
|
||||
if self.has_unaccent and sql_operator in ('ilike', 'not ilike'):
|
||||
query = "(unaccent(%s.\"%s\") %s unaccent('%s'))" % (table._table, left, sql_operator, right)
|
||||
else:
|
||||
|
@ -767,6 +771,10 @@ class expression(object):
|
|||
add_null = not str_utf8
|
||||
elif left in table._columns:
|
||||
params = table._columns[left]._symbol_set[1](right)
|
||||
else:
|
||||
# Matching else clause for the above else clause, where the
|
||||
# params are actually already in the query.
|
||||
params = []
|
||||
|
||||
if add_null:
|
||||
query = '(%s OR %s."%s" IS NULL)' % (query, table._table, left)
|
||||
|
|
Loading…
Reference in New Issue