Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions openupgradelib/openupgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -1790,10 +1790,11 @@ def update_module_names(cr, namespec, merge_modules=False):
of just a renaming.
"""
for (old_name, new_name) in namespec:
query = "SELECT id FROM ir_module_module WHERE name = %s"
query = "SELECT state FROM ir_module_module WHERE name = %s"
cr.execute(query, [new_name])
row = cr.fetchone()
if row and merge_modules:
replace = row and (row[0] == "uninstalled" or merge_modules)
if replace:
# Delete meta entries, that will avoid the entry removal
# They will be recreated by the new module anyhow.
query = "SELECT id FROM ir_module_module WHERE name = %s"
Expand Down Expand Up @@ -1835,7 +1836,7 @@ def update_module_names(cr, namespec, merge_modules=False):
if version_info[0] > 7 and version_info[0] < 16:
query = "UPDATE ir_translation SET module = %s WHERE module = %s"
logged_query(cr, query, (new_name, old_name))
if merge_modules:
if merge_modules or replace:
# Conserve old_name's state if new_name is uninstalled
logged_query(
cr,
Expand Down