[FIX] load view from file shall not raise an exception
authorFabien Meghazi <fme@openerp.com>
Mon, 6 Oct 2014 07:53:56 +0000 (09:53 +0200)
committerFabien Meghazi <fme@openerp.com>
Mon, 6 Oct 2014 08:00:35 +0000 (10:00 +0200)
In --dev mode, when a view can't be loaded from the file in spite of
being referenced in field `arch_fs`, the current behavior is to raise
an exception. In most cases, developpers don't want the view to fail
so the behavior has been changed in favor of a logger warning and
a fallback to `arch_db`.

openerp/addons/base/ir/ir_ui_view.py

index 3e4efde..60b09ff 100644 (file)
@@ -129,7 +129,8 @@ def get_view_arch_from_file(filename, xmlid):
                 node.tag = 'data'
             node.attrib.pop('id', None)
             return etree.tostring(node)
-    raise ValueError("Could not find view arch definition in file '%s' for xmlid '%s'" % (filename, xmlid))
+    _logger.warning("Could not find view arch definition in file '%s' for xmlid '%s'" % (filename, xmlid))
+    return None
 
 xpath_utils = etree.FunctionNamespace(None)
 xpath_utils['hasclass'] = _hasclass