diff options
| author | Olivier Dony <odo@openerp.com> | 2015-01-22 16:11:59 +0100 |
|---|---|---|
| committer | Olivier Dony <odo@openerp.com> | 2015-01-22 16:12:06 +0100 |
| commit | f69034ee09fcd2b4cb35bdb89bb0fe7bc37a9017 (patch) | |
| tree | 7976dffe27e031e20829c84c8ab29d6999330766 | |
| parent | 06187405c19727c5e20248a3b3515adb67842ef1 (diff) | |
[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.
| -rw-r--r-- | openerp/addons/base/ir/ir_ui_view.py | 7 |
1 files 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 |
