From 4b0042d07b77486b0a5d2652702c2940beebf62f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20Felipe=20Mil=C3=A9o?= Date: Fri, 17 Jan 2025 14:05:57 -0300 Subject: [PATCH] [MIG] l10n_br_fiscal.document.import.wizard.mixin --- l10n_br_account/__manifest__.py | 2 +- .../migrations/14.0.12.0.0/pre-migration.py | 24 +++++++++++++++++++ l10n_br_account/models/account_journal.py | 6 ++--- .../wizards/document_import_wizard_mixin.py | 2 +- 4 files changed, 29 insertions(+), 5 deletions(-) create mode 100644 l10n_br_account/migrations/14.0.12.0.0/pre-migration.py diff --git a/l10n_br_account/__manifest__.py b/l10n_br_account/__manifest__.py index 83af691e23a3..dc5a55342fbd 100644 --- a/l10n_br_account/__manifest__.py +++ b/l10n_br_account/__manifest__.py @@ -8,7 +8,7 @@ "license": "AGPL-3", "author": "Akretion, Odoo Community Association (OCA)", "website": "https://github.com/OCA/l10n-brazil", - "version": "14.0.11.15.0", + "version": "14.0.12.0.0", "development_status": "Beta", "maintainers": ["renatonlima", "rvalyi"], "depends": [ diff --git a/l10n_br_account/migrations/14.0.12.0.0/pre-migration.py b/l10n_br_account/migrations/14.0.12.0.0/pre-migration.py new file mode 100644 index 000000000000..277cbb3cfb47 --- /dev/null +++ b/l10n_br_account/migrations/14.0.12.0.0/pre-migration.py @@ -0,0 +1,24 @@ +# Copyright 2025 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_fiscal.document.import.wizard.mixin") diff --git a/l10n_br_account/models/account_journal.py b/l10n_br_account/models/account_journal.py index d73d2d48c513..0b7139510ccf 100644 --- a/l10n_br_account/models/account_journal.py +++ b/l10n_br_account/models/account_journal.py @@ -11,6 +11,6 @@ def create_invoice_from_attachment(self, attachment_ids=None): if self.env.company.country_id.code != "BR" or len(attachment_ids) < 1: return super().create_invoice_from_attachment(attachment_ids=attachment_ids) attachments = self.env["ir.attachment"].browse(attachment_ids) - return self.env[ - "l10n_br_fiscal.document.import.wizard.mixin" - ]._get_importer_action(attachments) + return self.env["l10n_br_fiscal.document.import.wizard"]._get_importer_action( + attachments + ) diff --git a/l10n_br_account/wizards/document_import_wizard_mixin.py b/l10n_br_account/wizards/document_import_wizard_mixin.py index 15ebcb609a3f..6dc5b42f083e 100644 --- a/l10n_br_account/wizards/document_import_wizard_mixin.py +++ b/l10n_br_account/wizards/document_import_wizard_mixin.py @@ -110,7 +110,7 @@ def _get_importer_action(self, attachments, move_id=None): for attachment in attachments: # this link will allow to retrive the next attachments to import: - attachment.res_model = "l10n_br_fiscal.document.import.wizard.mixin" + attachment.res_model = "l10n_br_fiscal.document.import.wizard" attachment.res_id = wizard.id wizard._onchange_file()