[IMP] ir_ui_view: somewhat better `type` functional field implementation.
bzr revid: vmt@openerp.com-20120814100049-dngykdg5l21q9vvp
This commit is contained in:
parent
1182be4291
commit
1534feb8f7
|
@ -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 = {
|
||||
|
|
Loading…
Reference in New Issue