[IMP] ir_ui_view: somewhat better `type` functional field implementation.

bzr revid: vmt@openerp.com-20120814100049-dngykdg5l21q9vvp
This commit is contained in:
Vo Minh Thu 2012-08-14 12:00:49 +02:00
parent 1182be4291
commit 1534feb8f7
1 changed files with 5 additions and 7 deletions

View File

@ -50,15 +50,13 @@ class view(osv.osv):
_name = 'ir.ui.view'
def _type_field(self, cr, uid, ids, name, args, context=None):
records = self.browse(cr, uid, ids, context)
result = dict((r.id, etree.fromstring(r.arch.encode('utf8')).tag) for r in records)
#NOTE: If we have inherited view the arch.tag will give us data and
# View mode will be undefined in case in hereit view we have view
# broken, Here for view which are inherited setting the parent view
# type.
for record in records:
result = {}
for record in self.browse(cr, uid, ids, context):
# Get the type from the inherited view if any.
if record.inherit_id:
result[record.id] = record.inherit_id.type
else:
result[record.id] = etree.fromstring(record.arch.encode('utf8')).tag
return result
_columns = {