From 0563093d1e3794988f5e17bb6ee89aa0a400a359 Mon Sep 17 00:00:00 2001 From: Raphael Collet Date: Thu, 2 Apr 2020 06:45:54 +0000 Subject: [PATCH] [IMP] ir.ui.view: optimize `_compute_arch` Simply avoid computing a field when not necessary. This saves 0.5% of the total installation time. closes odoo/odoo#48967 X-original-commit: f3fa93228b6ea8e9e171aaa508ca0218d70406f3 Related: odoo/enterprise#9655 Signed-off-by: Raphael Collet (rco) --- odoo/addons/base/models/ir_ui_view.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/odoo/addons/base/models/ir_ui_view.py b/odoo/addons/base/models/ir_ui_view.py index fa9640a479e..3ed1603efb2 100644 --- a/odoo/addons/base/models/ir_ui_view.py +++ b/odoo/addons/base/models/ir_ui_view.py @@ -268,10 +268,10 @@ actual arch. for view in self: arch_fs = None - xml_id = view.xml_id or view.key read_file = self._context.get('read_arch_from_file') or \ ('xml' in config['dev_mode'] and not view.arch_updated) - if read_file and view.arch_fs and xml_id: + if read_file and view.arch_fs and (view.xml_id or view.key): + xml_id = view.xml_id or view.key # It is safe to split on / herebelow because arch_fs is explicitely stored with '/' fullpath = get_resource_path(*view.arch_fs.split('/')) if fullpath: