diff --git a/account_bank_statement_import_ofx/__manifest__.py b/account_bank_statement_import_ofx/__manifest__.py index d1fc2aef..96b0dfd8 100644 --- a/account_bank_statement_import_ofx/__manifest__.py +++ b/account_bank_statement_import_ofx/__manifest__.py @@ -1,7 +1,7 @@ { 'name': 'Import OFX Bank Statement', 'category': 'Banking addons', - 'version': '12.0.1.1.0', + 'version': '13.0.1.0.0', 'license': 'AGPL-3', 'author': 'Odoo SA,' 'Akretion,' @@ -10,7 +10,7 @@ 'Nicolas JEUDY,' 'Le Filament,' 'Odoo Community Association (OCA)', - 'website': 'https://odoo-community.org/', + 'website': 'https://github.com/OCA/bank-statement-import', 'depends': [ 'account_bank_statement_import', ], diff --git a/account_bank_statement_import_ofx/models/account_journal.py b/account_bank_statement_import_ofx/models/account_journal.py index 83c5fb59..be290b94 100644 --- a/account_bank_statement_import_ofx/models/account_journal.py +++ b/account_bank_statement_import_ofx/models/account_journal.py @@ -7,8 +7,6 @@ class AccountJournal(models.Model): def _get_bank_statements_available_import_formats(self): """ Adds ofx to supported import formats. """ - rslt = super( - AccountJournal, - self)._get_bank_statements_available_import_formats() + rslt = super()._get_bank_statements_available_import_formats() rslt.append('ofx') return rslt diff --git a/account_bank_statement_import_ofx/readme/CONTRIBUTORS.rst b/account_bank_statement_import_ofx/readme/CONTRIBUTORS.rst new file mode 100644 index 00000000..06df3953 --- /dev/null +++ b/account_bank_statement_import_ofx/readme/CONTRIBUTORS.rst @@ -0,0 +1,7 @@ +* Odoo SA +* Alexis de Lattre +* Laurent Mignon +* Ronald Portier +* Sylvain LE GAL +* Nicolas JEUDY +* Le Filament diff --git a/account_bank_statement_import_ofx/readme/DESCRIPTION.rst b/account_bank_statement_import_ofx/readme/DESCRIPTION.rst new file mode 100644 index 00000000..bbc412a0 --- /dev/null +++ b/account_bank_statement_import_ofx/readme/DESCRIPTION.rst @@ -0,0 +1,4 @@ +This module adds support for the import of bank statements in `OFX format `_. + +Bank Statements may be generated containing a subset of the OFX information (only those transaction lines that are required for the +creation of the Financial Accounting records). diff --git a/account_bank_statement_import_ofx/readme/INSTALL.rst b/account_bank_statement_import_ofx/readme/INSTALL.rst new file mode 100644 index 00000000..39c87234 --- /dev/null +++ b/account_bank_statement_import_ofx/readme/INSTALL.rst @@ -0,0 +1 @@ +This module requires the `ofxparse `_ python lib. diff --git a/account_bank_statement_import_ofx/tests/test_import_bank_statement.py b/account_bank_statement_import_ofx/tests/test_import_bank_statement.py index 5bbf923b..fd27cd65 100644 --- a/account_bank_statement_import_ofx/tests/test_import_bank_statement.py +++ b/account_bank_statement_import_ofx/tests/test_import_bank_statement.py @@ -15,6 +15,7 @@ class TestOfxFile(TransactionCase): self.abs_model = self.env['account.bank.statement'] self.j_model = self.env['account.journal'] self.absl_model = self.env['account.bank.statement.line'] + self.ia_model = self.env['ir.attachment'] cur = self.env.ref('base.USD') self.env.ref('base.main_company').currency_id = cur.id bank = self.env['res.partner.bank'].create({ @@ -49,8 +50,12 @@ class TestOfxFile(TransactionCase): 'account_bank_statement_import_ofx', 'tests/test_ofx_file/', 'test_ofx_wrong.ofx') ofx_file_wrong = base64.b64encode(open(ofx_file_path, 'rb').read()) + attach = self.ia_model.create({ + 'name': 'test_ofx_wrong.ofx', + 'datas': ofx_file_wrong, + }) bank_statement = self.absi_model.create( - dict(data_file=ofx_file_wrong)) + dict(attachment_ids=[(6, 0, [attach.id])])) self.assertFalse(bank_statement._check_ofx(data_file=ofx_file_wrong)) def test_ofx_file_import(self): @@ -58,8 +63,12 @@ class TestOfxFile(TransactionCase): 'account_bank_statement_import_ofx', 'tests/test_ofx_file/', 'test_ofx.ofx') ofx_file = base64.b64encode(open(ofx_file_path, 'rb').read()) + attach = self.ia_model.create({ + 'name': 'test_ofx.ofx', + 'datas': ofx_file, + }) bank_statement = self.absi_model.create( - dict(data_file=ofx_file)) + dict(attachment_ids=[(6, 0, [attach.id])])) bank_statement.import_file() bank_st_record = self.abs_model.search( [('name', 'like', '123456')])[0] @@ -77,8 +86,12 @@ class TestOfxFile(TransactionCase): 'account_bank_statement_import_ofx', 'tests/test_ofx_file/', 'test_ofx_iban.ofx') ofx_file = base64.b64encode(open(ofx_file_path, 'rb').read()) + attach = self.ia_model.create({ + 'name': 'test_ofx.ofx', + 'datas': ofx_file, + }) bank_st = self.absi_model.create( - dict(data_file=ofx_file)) + dict(attachment_ids=[(6, 0, [attach.id])])) journal_iban_ofx = self.j_model.search([ ('name', '=', 'FR7630001007941234567890185')]) res = bank_st._check_journal_bank_account(journal_iban_ofx, diff --git a/account_bank_statement_import_ofx/wizard/account_bank_statement_import.py b/account_bank_statement_import_ofx/wizard/account_bank_statement_import.py index 15af6d0f..775f76be 100644 --- a/account_bank_statement_import_ofx/wizard/account_bank_statement_import.py +++ b/account_bank_statement_import_ofx/wizard/account_bank_statement_import.py @@ -19,9 +19,7 @@ class AccountBankStatementImport(models.TransientModel): _inherit = 'account.bank.statement.import' def _check_journal_bank_account(self, journal, account_number): - res = super( - AccountBankStatementImport, self - )._check_journal_bank_account(journal, account_number) + res = super()._check_journal_bank_account(journal, account_number) if not res: e_acc_num = journal.bank_account_id.sanitized_acc_number e_acc_num = e_acc_num.replace(" ", "") @@ -70,8 +68,7 @@ class AccountBankStatementImport(models.TransientModel): def _parse_file(self, data_file): ofx = self._check_ofx(data_file) if not ofx: - return super(AccountBankStatementImport, self)._parse_file( - data_file) + return super()._parse_file(data_file) transactions = [] total_amt = 0.00