From 9b9419ff7051e33ffd778c36154a4755405327bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20Felipe=20Mil=C3=A9o?= Date: Fri, 17 Jan 2025 10:32:22 -0300 Subject: [PATCH] [MIG] remove l10n_br_nfe.import_xml --- l10n_br_nfe/__manifest__.py | 2 +- .../migrations/14.0.20.0.0/pre-migration.py | 24 +++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 l10n_br_nfe/migrations/14.0.20.0.0/pre-migration.py diff --git a/l10n_br_nfe/__manifest__.py b/l10n_br_nfe/__manifest__.py index 4958d28cbdd7..51bf97a01f0d 100644 --- a/l10n_br_nfe/__manifest__.py +++ b/l10n_br_nfe/__manifest__.py @@ -11,7 +11,7 @@ "maintainers": ["rvalyi", "renatonlima"], "website": "https://github.com/OCA/l10n-brazil", "development_status": "Beta", - "version": "14.0.19.3.1", + "version": "14.0.20.0.0", "depends": [ "l10n_br_fiscal_edi", "l10n_br_fiscal_certificate", diff --git a/l10n_br_nfe/migrations/14.0.20.0.0/pre-migration.py b/l10n_br_nfe/migrations/14.0.20.0.0/pre-migration.py new file mode 100644 index 000000000000..242dd4457c8d --- /dev/null +++ b/l10n_br_nfe/migrations/14.0.20.0.0/pre-migration.py @@ -0,0 +1,24 @@ +# Copyright 2024 KMEE +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from openupgradelib import openupgrade + + +def delete_model(cr, model_name): + openupgrade.logged_query( + cr, + """ + DELETE FROM ir_model_access + WHERE model_id = (SELECT id FROM ir_model where model = '%s') + """ + % model_name, + ) + openupgrade.logged_query( + cr, "DELETE FROM ir_model_fields WHERE model = '%s'" % model_name + ) + openupgrade.logged_query(cr, "DELETE FROM ir_model WHERE model = '%s'" % model_name) + + +@openupgrade.migrate() +def migrate(env, version): + delete_model(env.cr, "l10n_br_nfe.import_xml")