From d2e297c3b317d8a89322a3346f9f7b421200e162 Mon Sep 17 00:00:00 2001 From: duongnguyen Date: Sun, 17 Jul 2022 17:45:49 +0700 Subject: [PATCH] [IMP] rename_fields: minor code improvement --- openupgradelib/openupgrade.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/openupgradelib/openupgrade.py b/openupgradelib/openupgrade.py index 731a0a05..d3e035b5 100644 --- a/openupgradelib/openupgrade.py +++ b/openupgradelib/openupgrade.py @@ -583,9 +583,8 @@ def rename_columns(cr, column_spec): ) -def _rename_field_on_dashboard( - env, model, old_field, new_field, dashboard_view_data - ): +def _rename_field_on_dashboard(env, model, old_field, new_field, + dashboard_view_data): for r in dashboard_view_data: parsed_arch = etree.XML(r.arch) act_window_ids = parsed_arch.xpath("//action/@name") @@ -671,9 +670,10 @@ def rename_fields(env, field_spec, no_deep=False): the environment. Not used for now. """ cr = env.cr - # Variable used to change field which present in ir.ui.view.custom - # like the one used on dashboard module - dashboard_view_data = env["ir.ui.view.custom"].search([]) + if version_info[0] > 9: + # Variable used to change field which present in ir.ui.view.custom + # like the one used on dashboard module + dashboard_view_data = env["ir.ui.view.custom"].search([]) for model, table, old_field, new_field in field_spec: if column_exists(cr, table, old_field): rename_columns(cr, {table: [(old_field, new_field)]})