Allows to link many2many on views

bzr revid: fp@tinyerp.com-63031530aabce50fbdb0c84fc7016b238466b60b
This commit is contained in:
Fabien Pinckaers 2007-09-30 18:16:41 +00:00
parent 8b2df6ba8b
commit caa1908d54
1 changed files with 2 additions and 2 deletions

View File

@ -293,7 +293,7 @@ class orm(object):
_name = None
_rec_name = 'name'
_parent_name = 'parent_id'
_date_name = 'date'
_date_name = 'date_start'
_order = 'id'
_inherits = {}
_sequence = None
@ -375,7 +375,7 @@ class orm(object):
if not res:
cr.execute("ALTER TABLE \"%s\" ADD FOREIGN KEY (%s) REFERENCES \"%s\" ON DELETE SET NULL" % (self._obj, f._fields_id, f._table))
elif isinstance(f, fields.many2many):
cr.execute("SELECT relname FROM pg_class WHERE relkind='r' AND relname=%s", (f._rel,))
cr.execute("SELECT relname FROM pg_class WHERE relkind in ('r','v') AND relname=%s", (f._rel,))
if not cr.dictfetchall():
#FIXME: Remove this try/except
try: