diff --git a/openerp/addons/base/ir/ir_ui_view.py b/openerp/addons/base/ir/ir_ui_view.py index 62981f3ee8c..b2805884f18 100644 --- a/openerp/addons/base/ir/ir_ui_view.py +++ b/openerp/addons/base/ir/ir_ui_view.py @@ -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 = {