[FIX] ir.ui.view: allow importing views without arch_fs, for base_import_module
Data-only modules imported via base_import_module do not have fs-backed source files, so the arch_fs field for views should always be NULL, and the arch_db version is always used. Avoid crashing at arch_fs detection during import via base_import_module.
This commit is contained in:
@@ -171,8 +171,11 @@ class view(osv.osv):
|
||||
if context and key in context:
|
||||
imd = context[key]
|
||||
if self._model._name == imd['model'] and (not view.xml_id or view.xml_id == imd['xml_id']):
|
||||
# we store the relative path to the resource instead of the absolute path
|
||||
data['arch_fs'] = '/'.join(get_resource_from_path(imd['xml_file'])[0:2])
|
||||
# we store the relative path to the resource instead of the absolute path, if found
|
||||
# (it will be missing e.g. when importing data-only modules using base_import_module)
|
||||
path_info = get_resource_from_path(imd['xml_file'])
|
||||
if path_info:
|
||||
data['arch_fs'] = '/'.join(path_info)[0:2]
|
||||
self.write(cr, uid, ids, data, context=context)
|
||||
|
||||
return True
|
||||
|
||||
Reference in New Issue
Block a user