Skip to content

Commit

Permalink
[FIX] base: Uninstall l10n_it_edi to avoid conflict with l10n_it_fatt…
Browse files Browse the repository at this point in the history
…urapa
  • Loading branch information
SirTakobi committed Oct 21, 2022
1 parent d3f6945 commit d09e091
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
15 changes: 15 additions & 0 deletions openupgrade_scripts/scripts/base/14.0.1.3/end-migration.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,20 @@
from openupgradelib import openupgrade


def uninstall_conflicting_it_edi(cr):
it_edi_conflicting_modules = ("l10n_it_edi", "l10n_it_fatturapa")
if all(
openupgrade.is_module_installed(cr.cr, m) for m in it_edi_conflicting_modules
):
it_edi_module = cr["ir.module.module"].search(
[
("name", "=", "l10n_it_edi"),
],
limit=1,
)
it_edi_module.button_uninstall()


@openupgrade.migrate()
def migrate(env, version):
"""Call disable_invalid_filters in every edition of openupgrade"""
Expand All @@ -14,3 +28,4 @@ def migrate(env, version):
openupgrade.update_module_names(
env.cr, [("web_diagram", "web")], merge_modules=True
)
uninstall_conflicting_it_edi(env)
15 changes: 15 additions & 0 deletions openupgrade_scripts/scripts/base/14.0.1.3/pre-migrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,20 @@ def deduplicate_ir_properties(cr):
)


def uninstall_conflicting_it_edi(cr):
it_edi_conflicting_modules = ("l10n_it_edi", "l10n_it_fatturapa")
if all(openupgrade.is_module_installed(cr, m) for m in it_edi_conflicting_modules):
# Mark as 'to_remove' to avoid raising a conflict; it will be installed anyway,
# but we will uninstall it for good in end-migration.
openupgrade.logged_query(
cr,
"""
UPDATE ir_module_module
SET state='to remove'
WHERE name = 'l10n_it_edi'""",
)


@openupgrade.migrate(use_env=False)
def migrate(cr, version):
"""
Expand Down Expand Up @@ -125,6 +139,7 @@ def migrate(cr, version):
# Perform module renames and merges
openupgrade.update_module_names(cr, renamed_modules.items())
openupgrade.update_module_names(cr, merged_modules.items(), merge_modules=True)
uninstall_conflicting_it_edi(cr)
# Migrate partners from Fil to Tagalog
# See https://github.com/odoo/odoo/commit/194ed76c5cc9
openupgrade.logged_query(
Expand Down

0 comments on commit d09e091

Please sign in to comment.