Skip to content

Commit

Permalink
Merge pull request #2380 from ForgeFlow/13.0-fix-mig-base-categories
Browse files Browse the repository at this point in the history
[13.0][FIX] base: Avoid possible issues with missing categories
  • Loading branch information
pedrobaeza authored Aug 4, 2020
2 parents dd2f051 + 1862825 commit ace5606
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions odoo/addons/base/migrations/13.0.1.3/pre-migration.py
Original file line number Diff line number Diff line change
Expand Up @@ -709,16 +709,16 @@ def rename_ir_module_category(env):
sql = "SELECT res_id FROM ir_model_data WHERE module=%s AND name=%s"
env.cr.execute(sql, (module, name))
new_row = env.cr.fetchone()
if new_row:
module, name = old_xmlid.split('.')
env.cr.execute(sql, (module, name))
old_row = env.cr.fetchone()
if old_row:
module, name = old_xmlid.split('.')
env.cr.execute(sql, (module, name))
old_row = env.cr.fetchone()
if old_row:
if new_row:
openupgrade_merge_records.merge_records(
env, "ir.module.category", [old_row[0]], new_row[0],
method="sql", model_table="ir_module_category")
else:
openupgrade.rename_xmlids(env.cr, [(old_xmlid, new_xmlid)])
else:
openupgrade.rename_xmlids(env.cr, [(old_xmlid, new_xmlid)])


@openupgrade.migrate()
Expand Down

0 comments on commit ace5606

Please sign in to comment.