Skip to content

Commit

Permalink
[MIG] l10n_br_fiscal.document.import.wizard.mixin
Browse files Browse the repository at this point in the history
  • Loading branch information
mileo committed Jan 17, 2025
1 parent 9b9419f commit 4b0042d
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 5 deletions.
2 changes: 1 addition & 1 deletion l10n_br_account/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand Down
24 changes: 24 additions & 0 deletions l10n_br_account/migrations/14.0.12.0.0/pre-migration.py
Original file line number Diff line number Diff line change
@@ -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")
6 changes: 3 additions & 3 deletions l10n_br_account/models/account_journal.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(

Check warning on line 14 in l10n_br_account/models/account_journal.py

View check run for this annotation

Codecov / codecov/patch

l10n_br_account/models/account_journal.py#L12-L14

Added lines #L12 - L14 were not covered by tests
attachments
)
2 changes: 1 addition & 1 deletion l10n_br_account/wizards/document_import_wizard_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Check warning on line 114 in l10n_br_account/wizards/document_import_wizard_mixin.py

View check run for this annotation

Codecov / codecov/patch

l10n_br_account/wizards/document_import_wizard_mixin.py#L113-L114

Added lines #L113 - L114 were not covered by tests

wizard._onchange_file()
Expand Down

0 comments on commit 4b0042d

Please sign in to comment.