From 247c1972ab541850ec71187ca320e6ddaa2644de Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Thu, 23 Apr 2009 10:57:50 +0200 Subject: [PATCH] [FIX] allow to use the field 'id' in views (i.e., needed for domain) bzr revid: christophe@tinyerp.com-20090423085750-rwt7kxgz7hmmop3f --- bin/osv/orm.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bin/osv/orm.py b/bin/osv/orm.py index 21029248635..258047c906e 100644 --- a/bin/osv/orm.py +++ b/bin/osv/orm.py @@ -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))