[IMP] ir_ui_view: do not use _logger.exception() (because there is no exception), add a check on `model`.
bzr revid: vmt@openerp.com-20130605121143-u2nkmcmeifphr54h
This commit is contained in:
parent
1ed9049041
commit
8d0a477644
|
@ -122,13 +122,12 @@ class view(osv.osv):
|
|||
@return: the rendered definition (arch) of the view, always utf-8 bytestring (legacy convention)
|
||||
if no error occurred, else False.
|
||||
"""
|
||||
if view.model not in self.pool:
|
||||
return False
|
||||
try:
|
||||
fvg = self.pool.get(view.model) and self.pool[view.model].fields_view_get(cr, uid, view_id=view.id, view_type=view.type, context=context)
|
||||
if not fvg:
|
||||
_logger.exception("Your view definition is wrong, model = '%s' defined on view = '%s' doesn't exist " % (view.model,view.name) )
|
||||
return fvg and fvg['arch'] or False
|
||||
fvg = self.pool[view.model].fields_view_get(cr, uid, view_id=view.id, view_type=view.type, context=context)
|
||||
return fvg['arch']
|
||||
except:
|
||||
_logger.exception("Can't render view %s for model: %s", view.xml_id, view.model)
|
||||
return False
|
||||
|
||||
def _check_xml(self, cr, uid, ids, context=None):
|
||||
|
@ -154,8 +153,15 @@ class view(osv.osv):
|
|||
return False
|
||||
return True
|
||||
|
||||
def _check_model(self, cr, uid, ids, context=None):
|
||||
for view in self.browse(cr, uid, ids, context):
|
||||
if view.model not in self.pool:
|
||||
return False
|
||||
return True
|
||||
|
||||
_constraints = [
|
||||
(_check_xml, 'Invalid XML for View Architecture!', ['arch'])
|
||||
(_check_model, 'The model name does not exist.', ['model']),
|
||||
(_check_xml, 'The model name does not exist or the view architecture cannot be rendered.', ['arch', 'model']),
|
||||
]
|
||||
|
||||
def _auto_init(self, cr, context=None):
|
||||
|
|
|
@ -1539,7 +1539,7 @@ class BaseModel(object):
|
|||
else:
|
||||
translated_msg = trans._get_source(cr, uid, self._name, 'constraint', lng, msg)
|
||||
error_msgs.append(
|
||||
_("Error occurred while validating the field(s) %s: %s") % (','.join(fields), translated_msg)
|
||||
_("The field(s) `%s` failed against a constraint: %s") % (', '.join(fields), translated_msg)
|
||||
)
|
||||
self._invalids.update(fields)
|
||||
if error_msgs:
|
||||
|
|
Loading…
Reference in New Issue