Skip to content

Commit

Permalink
[MIG] l10n_br_account_payment_order: Migration to 16.0
Browse files Browse the repository at this point in the history
  • Loading branch information
antoniospneto committed Jul 29, 2024
1 parent 5ea553e commit 80df2c9
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 17 deletions.
11 changes: 7 additions & 4 deletions l10n_br_account_payment_brcobranca/models/account_journal.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,12 +199,15 @@ def _get_moves(self, parser, result_row_list):
parser_vals = parser.get_move_line_vals(line)
values = self.prepare_move_line_vals(parser_vals, move)
move_store.append(values)
move_line_obj.with_context(check_move_validity=False).create(move_store)
self._write_extra_move_lines(parser, move)
move_store += self._get_extra_move_line_vals_list(parser, move)
if self.create_counterpart:
self._create_counterpart(parser, move)
move_store += self._get_counterpart_vals_list(
parser, move, move_store
)
# Check if move is balanced
move._check_balanced()
container = {"records": move}
with move._check_balanced(container):
move_line_obj.create(move_store)
# Computed total amount of the move
# move._amount_compute()
# No caso do CNAB o arquivo usado está sendo armazenado no
Expand Down
32 changes: 22 additions & 10 deletions l10n_br_account_payment_brcobranca/tests/test_payment_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

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

_module_ns = "odoo.addons.l10n_br_account_payment_brcobranca"
_provider_class_pay_order = (
Expand All @@ -18,7 +18,7 @@


@tagged("post_install", "-at_install")
class TestPaymentOrder(SavepointCase):
class TestPaymentOrder(TransactionCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
Expand Down Expand Up @@ -299,9 +299,11 @@ def test_payment_outside_cnab_writeoff_and_change_tittle_value(self):
.create(
{
"payment_type": "inbound",
"payment_method_id": self.env.ref(
"account.account_payment_method_manual_in"
).id,
"payment_method_line_id": (
self.journal_cash._get_available_payment_method_lines("inbound")
.filtered(lambda x: x.code == "manual")
.id
),
"partner_type": "customer",
"partner_id": self.partner_akretion.id,
"amount": 600,
Expand Down Expand Up @@ -796,7 +798,11 @@ def test_payment(self):
)
)
payment_register.journal_id = self.journal_cash
payment_register.payment_method_id = self.payment_method_manual_in
payment_register.payment_method_line_id = (
self.journal_cash._get_available_payment_method_lines("inbound").filtered(
lambda x: x.code == "manual"
)
)

# Perform the partial payment by setting the amount at 300 instead of 500
payment_register.amount = 100
Expand Down Expand Up @@ -851,7 +857,11 @@ def test_payment(self):
)
)
payment_register.journal_id = self.journal_cash
payment_register.payment_method_id = self.payment_method_manual_in
payment_register.payment_method_line_id = (
self.journal_cash._get_available_payment_method_lines("inbound").filtered(
lambda x: x.code == "manual"
)
)

# Perform the partial payment by setting the amount at 300 instead of 500
payment_register.amount = 50
Expand Down Expand Up @@ -907,9 +917,11 @@ def test_payment(self):
.create(
{
"payment_type": "inbound",
"payment_method_id": self.env.ref(
"account.account_payment_method_manual_in"
).id,
"payment_method_line_id": (
self.journal_cash._get_available_payment_method_lines("inbound")
.filtered(lambda x: x.code == "manual")
.id
),
"partner_type": "customer",
"partner_id": self.partner_akretion.id,
"amount": 150,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from unittest import mock

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

_module_ns = "odoo.addons.l10n_br_account_payment_brcobranca"
_provider_class_pay_order = (
Expand All @@ -19,7 +19,7 @@


@tagged("post_install", "-at_install")
class TestReturnImport(SavepointCase):
class TestReturnImport(TransactionCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
Expand All @@ -35,7 +35,7 @@ def setUpClass(cls):
{
"code": "X1014",
"name": "Bank Current Account - (test)",
"user_type_id": cls.env.ref("account.data_account_type_liquidity").id,
"account_type": "asset_cash",
}
)
cls.import_wizard_obj = cls.env["credit.statement.import"]
Expand Down

0 comments on commit 80df2c9

Please sign in to comment.