[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'
|
_name = 'ir.ui.view'
|
||||||
|
|
||||||
def _type_field(self, cr, uid, ids, name, args, context=None):
|
def _type_field(self, cr, uid, ids, name, args, context=None):
|
||||||
records = self.browse(cr, uid, ids, context)
|
result = {}
|
||||||
result = dict((r.id, etree.fromstring(r.arch.encode('utf8')).tag) for r in records)
|
for record in self.browse(cr, uid, ids, context):
|
||||||
#NOTE: If we have inherited view the arch.tag will give us data and
|
# Get the type from the inherited view if any.
|
||||||
# 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:
|
|
||||||
if record.inherit_id:
|
if record.inherit_id:
|
||||||
result[record.id] = record.inherit_id.type
|
result[record.id] = record.inherit_id.type
|
||||||
|
else:
|
||||||
|
result[record.id] = etree.fromstring(record.arch.encode('utf8')).tag
|
||||||
return result
|
return result
|
||||||
|
|
||||||
_columns = {
|
_columns = {
|
||||||
|
|
Loading…
Reference in New Issue