-
-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MIG] account_banking_ach_credit_transfer: Migration to 16.0
- Loading branch information
1 parent
73edb82
commit 23b0485
Showing
5 changed files
with
100 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import test_account_banking_ach_credit_trasnfer |
83 changes: 83 additions & 0 deletions
83
account_banking_ach_credit_transfer/tests/test_account_banking_ach_credit_trasnfer.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
# Copyright (C) 2024, ForgeFlow S.A. | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html) | ||
|
||
from datetime import datetime | ||
|
||
from odoo.tests.common import TransactionCase | ||
|
||
|
||
class TestACHCreditTransfer(TransactionCase): | ||
@classmethod | ||
def setUpClass(cls): | ||
super().setUpClass() | ||
cls.partner = cls.env["res.partner"].create({"name": "Partner 1"}) | ||
cls.company = cls.env.ref("base.main_company") | ||
cls.company.partner_id = cls.partner.id | ||
cls.company.legal_id_number = "12-3456789" | ||
cls.payment_method_model = cls.env["account.payment.method"] | ||
cls.ach_out_payment_method = cls.payment_method_model.search( | ||
[("code", "=", "ACH-Out")], limit=1 | ||
) | ||
cls.acme_bank = cls.env["res.bank"].create( | ||
{ | ||
"name": "ACME Bank", | ||
"bic": "GEBABEBB03B", | ||
"city": "Charleroi", | ||
"routing_number": "021000021", | ||
"country": cls.env.ref("base.be").id, | ||
} | ||
) | ||
bank_account = cls.env["res.partner.bank"].create( | ||
{ | ||
"acc_number": "0023032234211123", | ||
"partner_id": cls.partner.id, | ||
"bank_id": cls.acme_bank.id, | ||
"company_id": cls.company.id, | ||
} | ||
) | ||
cls.bank_journal = cls.env["account.journal"].create( | ||
{ | ||
"name": "Journal 1", | ||
"code": "J1", | ||
"type": "bank", | ||
"company_id": cls.company.id, | ||
"bank_account_id": bank_account.id, | ||
} | ||
) | ||
cls.payment_mode = cls.env.ref( | ||
"account_banking_ach_credit_transfer.payment_mode_outbound_ach_ct1" | ||
) | ||
cls.payment_mode.variable_journal_ids += cls.bank_journal | ||
|
||
def test_account_payment_order(self): | ||
|
||
self.payment_order = self.env["account.payment.order"].create( | ||
{ | ||
"payment_type": "outbound", | ||
"payment_mode_id": self.payment_mode.id, | ||
"journal_id": self.bank_journal.id, | ||
"payment_method_id": self.ach_out_payment_method.id, | ||
} | ||
) | ||
line_created_due = ( | ||
self.env["account.payment.line.create"] | ||
.with_context( | ||
active_model="account.payment.order", active_id=self.payment_order.id | ||
) | ||
.create({"date_type": "due", "due_date": datetime.now()}) | ||
) | ||
line_created_due.payment_mode = "any" | ||
line_created_due.target_move = "all" | ||
line_created_due.allow_blocked = True | ||
line_created_due.populate() | ||
line_created_due.create_payment_lines() | ||
self.assertEqual(len(line_created_due.move_line_ids), 1) | ||
line_created_due.move_line_ids.partner_id.bank_ids.bank_id.routing_number = ( | ||
35645 | ||
) | ||
self.assertEqual(self.payment_order.state, "draft") | ||
self.payment_order.draft2open() | ||
self.assertEqual(self.payment_order.state, "open") | ||
self.payment_order.generate_payment_file() | ||
self.payment_order.generated2uploaded() | ||
self.assertEqual(self.payment_order.state, "uploaded") |