[FIX] views: correct type detection

bzr revid: chs@openerp.com-20130627153758-1yhk7d79is5c707r
This commit is contained in:
Christophe Simonis 2013-06-27 17:37:58 +02:00
parent a0d05319e4
commit d84c90b41d
1 changed files with 3 additions and 2 deletions

View File

@ -131,11 +131,12 @@ class view(osv.osv):
_relaxng_validator = None
def create(self, cr, uid, values, context=None):
if not 'type' in values:
if 'type' not in values:
if values.get('inherit_id'):
values['type'] = self.browse(cr, uid, values['inherit_id'], context).type
else:
values['type'] = etree.fromstring(values['arch'].encode('utf8')).tag
values['type'] = etree.fromstring(values['arch']).tag
if not values.get('name'):
values['name'] = "%s %s" % (values['model'], values['type'])
return super(view, self).create(cr, uid, values, context)