[IMP] bulk-update fields_view_get result via dict.update instead of a bunch of __setitem__

bzr revid: xmo@openerp.com-20110915111213-zigij077k9ss9p6e
This commit is contained in:
Xavier Morel 2011-09-15 13:12:13 +02:00
parent 7e8b8a3ce8
commit 8a9c0dbad7
1 changed files with 11 additions and 11 deletions

View File

@ -1954,14 +1954,13 @@ class orm_template(object):
# if a view was found
if sql_res:
result['type'] = sql_res['type']
result['view_id'] = sql_res['id']
source = etree.fromstring(encode(sql_res['arch']))
result['arch'] = apply_view_inheritance(source, result['view_id'])
result['name'] = sql_res['name']
result['field_parent'] = sql_res['field_parent'] or False
result.update(
arch=apply_view_inheritance(source, sql_res['id']),
type=sql_res['type'],
view_id=sql_res['id'],
name=sql_res['name'],
field_parent=sql_res['field_parent'] or False)
else:
# otherwise, build some kind of default view
@ -1994,10 +1993,11 @@ class orm_template(object):
else:
# what happens here, graph case?
raise except_orm(_('Invalid Architecture!'), _("There is no view of type '%s' defined for the structure!") % view_type)
result['arch'] = etree.fromstring(encode(xml))
result['name'] = 'default'
result['field_parent'] = False
result['view_id'] = 0
result.update(
arch=etree.fromstring(encode(xml)),
name='default',
field_parent=False,
view_id=0)
if parent_view_model != self._name:
ctx = context.copy()