Skip to content

Commit

Permalink
Code quality & unit test
Browse files Browse the repository at this point in the history
Debug Unit test

Update account_payment_method.py
  • Loading branch information
lanto-razafindrabe committed Feb 13, 2025
1 parent d48a285 commit 9327ed6
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 18 deletions.
6 changes: 0 additions & 6 deletions canada_bank_transfer/data/account_payment_method_data.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>

<!-- <record id="payment_method_eft" model="account.payment.method.line">-->
<!-- <field name="name">EFT</field>-->
<!-- <field name="code">eft</field>-->
<!-- <field name="payment_method_id" ref="account.account_payment_method_manual_out"/>-->
<!-- </record>-->

<record id="payment_method_eft" model="account.payment.method">
<field name="name">EFT</field>
<field name="code">eft</field>
Expand Down
2 changes: 1 addition & 1 deletion canada_bank_transfer/models/account_eft.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ def generate_eft_file(self):
{
"filename": "{}-{}.txt".format(self.name, self.sequence),
"content": content,
"content_binary": base64.encodestring(content.encode("utf-8")),
"content_binary": base64.encodebytes(content.encode("utf-8")),
}
)
return True
Expand Down
2 changes: 1 addition & 1 deletion canada_bank_transfer/models/account_journal.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def create(self, vals_list):

def write(self, vals):
super().write(vals)
if "available_payment_method_ids" in vals:
if "outbound_payment_method_line_ids" in vals:
for journal in self:
journal._setup_eft_sequence()
return True
Expand Down
2 changes: 1 addition & 1 deletion canada_bank_transfer/models/account_payment_method.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def _get_payment_method_information(self):
methods_info = super()._get_payment_method_information()
methods_info.update(
{
"eft": {"mode": "multi", "domain": [("type", "in", ("bank"))]},
"eft": {"mode": "multi", "domain": [("type", "=", "bank")]},
}
)
return methods_info
6 changes: 0 additions & 6 deletions canada_bank_transfer/note_migration.txt

This file was deleted.

9 changes: 7 additions & 2 deletions canada_bank_transfer/tests/common.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Copyright 2019 - today Numigi (tm) and all its contributors (https://bit.ly/numigiens)
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

from odoo import Command
from odoo.tests import common

USER_SHORT_NAME = "YOUR COMPANY"
Expand Down Expand Up @@ -47,18 +48,22 @@ def setUpClass(cls):
)

cls.eft_method = cls.env.ref("canada_bank_transfer.payment_method_eft")
cad_currency = cls.env.ref("base.CAD")
cad_currency.write({"active": True})

cls.journal = cls.env["account.journal"].create(
{
"name": "NBC 10001 006 1000001",
"type": "bank",
"code": "NBC",
"bank_account_id": cls.nbc_account.id,
"currency_id": cls.env.ref("base.CAD").id,
"currency_id": cad_currency.id,
"eft_user_short_name": USER_SHORT_NAME,
"eft_user_number": USER_NUMBER,
"eft_destination": DESTINATION,
"available_payment_method_ids": [(4, cls.eft_method.id)],
"outbound_payment_method_line_ids": [
Command.create({"payment_method_id": cls.eft_method.id}),
],
}
)

Expand Down
9 changes: 8 additions & 1 deletion canada_bank_transfer/tests/test_account_journal.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Copyright 2019 - today Numigi (tm) and all its contributors (https://bit.ly/numigiens)
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

from odoo import Command
from .common import EFTCase


Expand All @@ -17,5 +18,11 @@ def test_eft_sequence__write(self):
}
)
assert not journal.eft_sequence_id
journal.available_payment_method_ids = self.eft_method
journal.write(
{
"outbound_payment_method_line_ids": [
Command.create({"payment_method_id": self.eft_method.id})
]
}
)
assert journal.eft_sequence_id

0 comments on commit 9327ed6

Please sign in to comment.