[FIX] allow to use the field 'id' in views (i.e., needed for domain)

bzr revid: christophe@tinyerp.com-20090423085750-rwt7kxgz7hmmop3f
This commit is contained in:
Christophe Simonis 2009-04-23 10:57:50 +02:00
parent 9bcf97fa2d
commit 247c1972ab
1 changed files with 4 additions and 1 deletions

View File

@ -893,7 +893,10 @@ class orm_template(object):
arch = node.toxml(encoding="utf-8").replace('\t', '')
fields = self.fields_get(cr, user, fields_def.keys(), context)
for field in fields_def:
if field in fields:
if field == 'id':
# sometime, the view may containt the (invisible) field 'id' needed for a domain (when 2 objects have cross references)
fields['id'] = {'readonly': True, 'type': 'integer', 'string': 'ID'}
elif field in fields:
fields[field].update(fields_def[field])
else:
cr.execute('select name, model from ir_ui_view where (id=%s or inherit_id=%s) and arch like %s', (view_id, view_id, '%%%s%%' % field))