Skip to content

Commit

Permalink
[MIG] l10n_br_account_nfe: Migration to 15.0
Browse files Browse the repository at this point in the history
  • Loading branch information
rvalyi committed Aug 8, 2024
1 parent e919722 commit 0415d8f
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 28 deletions.
2 changes: 1 addition & 1 deletion l10n_br_account_nfe/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"author": "Engenere," "Akretion," "Odoo Community Association (OCA)",
"maintainers": ["antoniospneto", "felipemotter", "mbcosta"],
"website": "https://github.com/OCA/l10n-brazil",
"version": "14.0.5.0.0",
"version": "15.0.1.0.0",
"development_status": "Beta",
"depends": [
"l10n_br_nfe",
Expand Down
3 changes: 2 additions & 1 deletion l10n_br_account_nfe/models/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ def _is_installment(self):
self.ensure_one()
self.move_ids.financial_move_line_ids.mapped("date_maturity")
moves_terms = self.move_ids.financial_move_line_ids.filtered(
lambda move_line: move_line.date_maturity > move_line.date
lambda move_line: move_line.date_maturity
and move_line.date_maturity > move_line.date
)
return True if len(moves_terms) > 0 else False

Expand Down
46 changes: 24 additions & 22 deletions l10n_br_account_nfe/tests/test_nfce_contingency.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,67 +7,69 @@


class TestAccountNFCeContingency(TransactionCase):
def setUp(self):
super().setUp()
@classmethod
def setUpClass(cls):
super().setUpClass()
# this hook is required to test l10n_br_account_nfe alone:
hooks.register_hook(
self.env,
cls.env,
"l10n_br_nfe",
"odoo.addons.l10n_br_nfe_spec.models.v4_0.leiaute_nfe_v4_00",
)
self.document_id = self.env.ref("l10n_br_nfe.demo_nfce_same_state")
self.prepare_account_move_nfce()
cls.document_id = cls.env.ref("l10n_br_nfe.demo_nfce_same_state")
cls.prepare_account_move_nfce()

def prepare_account_move_nfce(self):
receivable_account_id = self.env["account.account"].create(
@classmethod
def prepare_account_move_nfce(cls):
receivable_account_id = cls.env["account.account"].create(
{
"name": "TEST ACCOUNT",
"code": "1.1.1.2.2",
"code": "01.1.1.2.2",
"reconcile": 1,
"company_id": self.env.ref("base.main_company").id,
"user_type_id": self.env.ref("account.data_account_type_receivable").id,
"company_id": cls.env.ref("base.main_company").id,
"user_type_id": cls.env.ref("account.data_account_type_receivable").id,
}
)
payable_account_id = self.env["account.account"].create(
payable_account_id = cls.env["account.account"].create(
{
"name": "TEST ACCOUNT 2",
"code": "1.1.1.2.3",
"code": "01.1.1.2.3",
"reconcile": 1,
"company_id": self.env.ref("base.main_company").id,
"user_type_id": self.env.ref("account.data_account_type_payable").id,
"company_id": cls.env.ref("base.main_company").id,
"user_type_id": cls.env.ref("account.data_account_type_payable").id,
}
)
payment_method = self.env.ref("account.account_payment_method_manual_in").id
journal_id = self.env["account.journal"].create(
payment_method = cls.env.ref("account.account_payment_method_manual_in").id
journal_id = cls.env["account.journal"].create(
{
"name": "JOURNAL TEST",
"code": "TEST",
"type": "bank",
"company_id": self.env.ref("base.main_company").id,
"company_id": cls.env.ref("base.main_company").id,
}
)
payment_mode = self.env["account.payment.mode"].create(
payment_mode = cls.env["account.payment.mode"].create(
{
"name": "PAYMENT MODE TEST",
"company_id": self.env.ref("base.main_company").id,
"company_id": cls.env.ref("base.main_company").id,
"payment_method_id": payment_method,
"fiscal_payment_mode": "15",
"bank_account_link": "fixed",
"fixed_journal_id": journal_id.id,
}
)
self.document_move_id = self.env["account.move"].create(
cls.document_move_id = cls.env["account.move"].create(
{
"name": "MOVE TEST",
"payment_mode_id": payment_mode.id,
"company_id": self.env.ref("base.main_company").id,
"company_id": cls.env.ref("base.main_company").id,
"line_ids": [
(0, 0, {"account_id": receivable_account_id.id, "credit": 10}),
(0, 0, {"account_id": payable_account_id.id, "debit": 10}),
],
}
)
self.document_move_id.fiscal_document_id = self.document_id.id
cls.document_move_id.fiscal_document_id = cls.document_id.id

def test_nfce_contingencia(self):
self.document_id._update_nfce_for_offline_contingency()
Expand Down
4 changes: 2 additions & 2 deletions l10n_br_account_nfe/tests/test_nfe_danfe_account.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from unittest.mock import patch

from odoo.tests import SavepointCase, tagged
from odoo.tests import TransactionCase, tagged


@tagged("post_install", "-at_install")
class TestDanfe(SavepointCase):
class TestDanfe(TransactionCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo.exceptions import UserError
from odoo.tests import Form, SavepointCase, tagged
from odoo.tests import Form, TransactionCase, tagged


@tagged("post_install", "-at_install")
class TestGeneratePaymentInfo(SavepointCase):
class TestGeneratePaymentInfo(TransactionCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
Expand Down

0 comments on commit 0415d8f

Please sign in to comment.