From f69034ee09fcd2b4cb35bdb89bb0fe7bc37a9017 Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Thu, 22 Jan 2015 16:11:59 +0100 Subject: [PATCH] [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. --- openerp/addons/base/ir/ir_ui_view.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/openerp/addons/base/ir/ir_ui_view.py b/openerp/addons/base/ir/ir_ui_view.py index 054ecf9d045..7bbc9554b46 100644 --- a/openerp/addons/base/ir/ir_ui_view.py +++ b/openerp/addons/base/ir/ir_ui_view.py @@ -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