Skip to content

Commit

Permalink
[IMP] rename_fields: minor code improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
duong77476-viindoo committed Jul 17, 2022
1 parent 2c16abd commit d2e297c
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions openupgradelib/openupgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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)]})
Expand Down

0 comments on commit d2e297c

Please sign in to comment.