[MERGE] merge smile branch.
[REF] rewrite error generation when a view field is not found in the model bzr revid: christophe@tinyerp.com-20090119110150-dzxto9uvwsqkva6s
This commit is contained in:
commit
520f5aec9c
|
@ -775,7 +775,7 @@ class orm_template(object):
|
|||
def view_header_get(self, cr, user, view_id=None, view_type='form', context=None):
|
||||
return False
|
||||
|
||||
def __view_look_dom(self, cr, user, node, context=None):
|
||||
def __view_look_dom(self, cr, user, node, view_id, context=None):
|
||||
if not context:
|
||||
context = {}
|
||||
result = False
|
||||
|
@ -801,7 +801,7 @@ class orm_template(object):
|
|||
node.removeChild(f)
|
||||
ctx = context.copy()
|
||||
ctx['base_model_name'] = self._name
|
||||
xarch, xfields = self.pool.get(relation).__view_look_dom_arch(cr, user, f, ctx)
|
||||
xarch, xfields = self.pool.get(relation).__view_look_dom_arch(cr, user, f, view_id, ctx)
|
||||
views[str(f.localName)] = {
|
||||
'arch': xarch,
|
||||
'fields': xfields
|
||||
|
@ -851,12 +851,12 @@ class orm_template(object):
|
|||
|
||||
if childs:
|
||||
for f in node.childNodes:
|
||||
fields.update(self.__view_look_dom(cr, user, f, context))
|
||||
fields.update(self.__view_look_dom(cr, user, f, view_id, context))
|
||||
|
||||
return fields
|
||||
|
||||
def __view_look_dom_arch(self, cr, user, node, context=None):
|
||||
fields_def = self.__view_look_dom(cr, user, node, context=context)
|
||||
def __view_look_dom_arch(self, cr, user, node, view_id, context=None):
|
||||
fields_def = self.__view_look_dom(cr, user, node, view_id, context=context)
|
||||
|
||||
rolesobj = self.pool.get('res.roles')
|
||||
usersobj = self.pool.get('res.users')
|
||||
|
@ -885,7 +885,18 @@ class orm_template(object):
|
|||
arch = node.toxml(encoding="utf-8").replace('\t', '')
|
||||
fields = self.fields_get(cr, user, fields_def.keys(), context)
|
||||
for field in fields_def:
|
||||
fields[field].update(fields_def[field])
|
||||
if field in fields:
|
||||
fields[field].update(fields_def[field])
|
||||
else:
|
||||
cr.execute('select name, model from ir_ui_view where (id=%s or inherit_id=%s) and arch like %s', (view_id, view_id, '%%%s%%' % field))
|
||||
res = cr.fetchall()[:]
|
||||
model = res[0][1]
|
||||
res.insert(0, ("Can't find field '%s' in the following view parts composing the view of object model '%s':" % (field, model), None))
|
||||
msg = "\n * ".join([r[0] for r in res])
|
||||
msg += "\n\nEither you wrongly customized this view, or some modules bringing those views are not compatible with your current data model"
|
||||
netsvc.Logger().notifyChannel('orm', netsvc.LOG_ERROR, msg)
|
||||
raise except_orm('View error', msg)
|
||||
|
||||
return arch, fields
|
||||
|
||||
def __get_default_calendar_view(self):
|
||||
|
@ -1072,7 +1083,7 @@ class orm_template(object):
|
|||
result['view_id'] = 0
|
||||
|
||||
doc = dom.minidom.parseString(encode(result['arch']))
|
||||
xarch, xfields = self.__view_look_dom_arch(cr, user, doc, context=context)
|
||||
xarch, xfields = self.__view_look_dom_arch(cr, user, doc, view_id, context=context)
|
||||
result['arch'] = xarch
|
||||
result['fields'] = xfields
|
||||
if toolbar:
|
||||
|
|
Loading…
Reference in New Issue