diff --git a/account_statement_import_ofx/__manifest__.py b/account_statement_import_ofx/__manifest__.py index 77b622e8f..8b215ff77 100644 --- a/account_statement_import_ofx/__manifest__.py +++ b/account_statement_import_ofx/__manifest__.py @@ -1,7 +1,7 @@ { "name": "Import OFX Bank Statement", "category": "Banking addons", - "version": "16.0.1.0.0", + "version": "17.0.1.0.0", "license": "AGPL-3", "author": "Odoo SA," "Akretion," @@ -14,7 +14,7 @@ "development_status": "Mature", "website": "https://github.com/OCA/bank-statement-import", "depends": ["account_statement_import_file"], - "data": ["views/account_statement_import.xml"], + "data": ["wizard/account_statement_import.xml"], "external_dependencies": {"python": ["ofxparse"]}, "installable": True, } diff --git a/account_statement_import_ofx/tests/test_import_bank_statement.py b/account_statement_import_ofx/tests/test_import_bank_statement.py index c9aed5a46..03995d20d 100644 --- a/account_statement_import_ofx/tests/test_import_bank_statement.py +++ b/account_statement_import_ofx/tests/test_import_bank_statement.py @@ -1,32 +1,31 @@ import base64 import datetime -from odoo.modules.module import get_module_resource -from odoo.tests.common import TransactionCase +import odoo.tests.common as common +from odoo.tools.misc import file_path -class TestOfxFile(TransactionCase): +class TestOfxFile(common.TransactionCase): """Tests for import bank statement ofx file format (account.bank.statement.import) """ - def setUp(self): - super(TestOfxFile, self).setUp() - self.asi_model = self.env["account.statement.import"] - self.abs_model = self.env["account.bank.statement"] - self.j_model = self.env["account.journal"] - self.absl_model = self.env["account.bank.statement.line"] - cur = self.env.ref("base.USD") - # self.env.ref("base.main_company").currency_id = cur.id - bank = self.env["res.partner.bank"].create( + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.asi_model = cls.env["account.statement.import"] + cls.abs_model = cls.env["account.bank.statement"] + cls.absl_model = cls.env["account.bank.statement.line"] + cur = cls.env.ref("base.USD") + bank = cls.env["res.partner.bank"].create( { "acc_number": "123456", - "partner_id": self.env.ref("base.main_partner").id, - "company_id": self.env.ref("base.main_company").id, - "bank_id": self.env.ref("base.res_bank_1").id, + "partner_id": cls.env.ref("base.main_partner").id, + "company_id": cls.env.ref("base.main_company").id, + "bank_id": cls.env.ref("base.res_bank_1").id, } ) - self.env["account.journal"].create( + cls.env["account.journal"].create( { "name": "Bank Journal TEST OFX", "code": "BNK12", @@ -35,17 +34,15 @@ def setUp(self): "currency_id": cur.id, } ) - - bank_iban_ofx = self.env["res.partner.bank"].create( + bank_iban_ofx = cls.env["res.partner.bank"].create( { "acc_number": "FR7630001007941234567890185", - "partner_id": self.env.ref("base.main_partner").id, - "company_id": self.env.ref("base.main_company").id, - "bank_id": self.env.ref("base.res_bank_1").id, + "partner_id": cls.env.ref("base.main_partner").id, + "company_id": cls.env.ref("base.main_company").id, + "bank_id": cls.env.ref("base.res_bank_1").id, } ) - - self.env["account.journal"].create( + cls.env["account.journal"].create( { "name": "FR7630001007941234567890185", "code": "BNK13", @@ -56,10 +53,8 @@ def setUp(self): ) def test_wrong_ofx_file_import(self): - ofx_file_path = get_module_resource( - "account_statement_import_ofx", - "tests/test_ofx_file/", - "test_ofx_wrong.ofx", + ofx_file_path = file_path( + "account_statement_import_ofx/tests/test_ofx_file/test_ofx_wrong.ofx" ) ofx_file_wrong = base64.b64encode(open(ofx_file_path, "rb").read()) bank_statement = self.asi_model.create( @@ -71,8 +66,8 @@ def test_wrong_ofx_file_import(self): self.assertFalse(bank_statement._check_ofx(data_file=ofx_file_wrong)) def test_ofx_file_import(self): - ofx_file_path = get_module_resource( - "account_statement_import_ofx", "tests/test_ofx_file/", "test_ofx.ofx" + ofx_file_path = file_path( + "account_statement_import_ofx/tests/test_ofx_file/test_ofx.ofx" ) ofx_file = base64.b64encode(open(ofx_file_path, "rb").read()) bank_statement = self.asi_model.create( @@ -95,10 +90,8 @@ def test_ofx_file_import(self): self.assertEqual(line.date, datetime.date(2013, 8, 24)) def test_check_journal_bank_account(self): - ofx_file_path = get_module_resource( - "account_statement_import_ofx", - "tests/test_ofx_file/", - "test_ofx_iban.ofx", + ofx_file_path = file_path( + "account_statement_import_ofx/tests/test_ofx_file/test_ofx_iban.ofx" ) ofx_file = base64.b64encode(open(ofx_file_path, "rb").read()) bank_st = self.asi_model.create( diff --git a/account_statement_import_ofx/views/account_statement_import.xml b/account_statement_import_ofx/wizard/account_statement_import.xml similarity index 100% rename from account_statement_import_ofx/views/account_statement_import.xml rename to account_statement_import_ofx/wizard/account_statement_import.xml