diff --git a/account_bank_statement_import_camt/tests/test_import_bank_statement.py b/account_bank_statement_import_camt/tests/test_import_bank_statement.py deleted file mode 100644 index 07c2de8..0000000 --- a/account_bank_statement_import_camt/tests/test_import_bank_statement.py +++ /dev/null @@ -1,128 +0,0 @@ -"""Run test to import camt.053 import.""" -# © 2013-2016 Therp BV -# Copyright 2017 Open Net Sàrl -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -import base64 -import difflib -import pprint -import tempfile - -from io import StringIO - -from odoo.tests.common import TransactionCase -from odoo.modules.module import get_module_resource - - -class TestParser(TransactionCase): - """Tests for the camt parser itself.""" - def setUp(self): - super(TestParser, self).setUp() - self.parser = self.env['account.bank.statement.import.camt.parser'] - - def _do_parse_test(self, inputfile, goldenfile): - print("\n\ninputfile = {} / goldenfile = {}".format(inputfile, goldenfile)) - testfile = get_module_resource( - 'account_bank_statement_import_camt', - 'test_files', - inputfile, - ) - data = open(testfile, 'rb').read() - res = self.parser.parse(data) - with tempfile.NamedTemporaryFile(mode='w+', suffix='.pydata') as temp: - import ipdb; ipdb.set_trace(context=10) - pprint.pprint(res, temp, width=160) - goldenfile_res = get_module_resource( - 'account_bank_statement_import_camt', - 'test_files', - goldenfile, - ) - with open(goldenfile_res, 'r') as golden: - temp.seek(0) - diff = list( - difflib.unified_diff(golden.readlines(), temp.readlines(), - golden.name, temp.name)) - if len(diff) > 2: - self.fail( - "actual output doesn't match expected output:\n%s" % - "".join(diff)) - - def test_parse(self): - self._do_parse_test( - 'test-camt053', - 'golden-camt053.pydata') - - def test_parse_txdtls(self): - self._do_parse_test( - 'test-camt053-txdtls', - 'golden-camt053-txdtls.pydata') - - -class TestImport(TransactionCase): - """Run test to import camt import.""" - transactions = [ - { - 'account_number': 'NL46ABNA0499998748', - 'amount': -754.25, - 'date': '2014-01-05', - 'ref': '435005714488-ABNO33052620', - }, - ] - - def setUp(self): - super(TestImport, self).setUp() - bank = self.env['res.partner.bank'].create({ - 'acc_number': 'NL77ABNA0574908765', - '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, - }) - self.env['account.journal'].create({ - 'name': 'Bank Journal - (test camt)', - 'code': 'TBNKCAMT', - 'type': 'bank', - 'bank_account_id': bank.id, - }) - - def test_statement_import(self): - """Test correct creation of single statement.""" - testfile = get_module_resource( - 'account_bank_statement_import_camt', - 'test_files', - 'test-camt053', - ) - datafile = open(testfile, 'rb').read() - - action = self.env['account.bank.statement.import'].create({ - 'data_file': base64.b64encode(datafile) - }).import_file() - - for statement in self.env['account.bank.statement'].browse( - action['context']['statement_ids'] - ): - self.assertTrue(any( - all( - line[key] == self.transactions[0][key] - for key in ['amount', 'date', 'ref'] - ) and - line.bank_account_id.acc_number == - self.transactions[0]['account_number'] - for line in statement.line_ids - )) - - def test_zip_import(self): - """Test import of multiple statements from zip file.""" - testfile = get_module_resource( - 'account_bank_statement_import_camt', - 'test_files', - 'test-camt053.zip', - ) - datafile = open(testfile, 'rb').read() - - action = self.env['account.bank.statement.import'].create({ - 'data_file': base64.b64encode(datafile), - }).import_file() - - for statement in self.env['account.bank.statement'].browse( - action['context']['statement_ids'] - ): - self.assertTrue(statement.line_ids) diff --git a/account_bank_statement_import_camt/README.rst b/account_bank_statement_import_camt_oca/README.rst similarity index 100% rename from account_bank_statement_import_camt/README.rst rename to account_bank_statement_import_camt_oca/README.rst diff --git a/account_bank_statement_import_camt/__init__.py b/account_bank_statement_import_camt_oca/__init__.py similarity index 100% rename from account_bank_statement_import_camt/__init__.py rename to account_bank_statement_import_camt_oca/__init__.py diff --git a/account_bank_statement_import_camt/__manifest__.py b/account_bank_statement_import_camt_oca/__manifest__.py similarity index 100% rename from account_bank_statement_import_camt/__manifest__.py rename to account_bank_statement_import_camt_oca/__manifest__.py diff --git a/account_bank_statement_import_camt/i18n/de.po b/account_bank_statement_import_camt_oca/i18n/de.po similarity index 78% rename from account_bank_statement_import_camt/i18n/de.po rename to account_bank_statement_import_camt_oca/i18n/de.po index b503264..f4d4e71 100644 --- a/account_bank_statement_import_camt/i18n/de.po +++ b/account_bank_statement_import_camt_oca/i18n/de.po @@ -1,6 +1,6 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: -# * account_bank_statement_import_camt +# * account_bank_statement_import_camt_oca # # Translators: msgid "" @@ -18,7 +18,7 @@ msgstr "" "Plural-Forms: nplurals=2; plural=(n > 1);\n" "X-Generator: Poedit 1.8.3\n" -#. module: account_bank_statement_import_camt -#: model:ir.model,name:account_bank_statement_import_camt.model_account_bank_statement_import +#. module: account_bank_statement_import_camt_oca +#: model:ir.model,name:account_bank_statement_import_camt_oca.model_account_bank_statement_import msgid "Import Bank Statement" msgstr "Kontoauszug importieren" diff --git a/account_bank_statement_import_camt/i18n/es.po b/account_bank_statement_import_camt_oca/i18n/es.po similarity index 54% rename from account_bank_statement_import_camt/i18n/es.po rename to account_bank_statement_import_camt_oca/i18n/es.po index b5f508d..e56d7f8 100644 --- a/account_bank_statement_import_camt/i18n/es.po +++ b/account_bank_statement_import_camt_oca/i18n/es.po @@ -1,7 +1,7 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: -# * account_bank_statement_import_camt -# +# * account_bank_statement_import_camt_oca +# # Translators: # OCA Transbot , 2017 # enjolras , 2018 @@ -19,37 +19,37 @@ msgstr "" "Language: es\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" -#. module: account_bank_statement_import_camt -#: model:ir.ui.view,arch_db:account_bank_statement_import_camt.account_bank_statement_import_view +#. module: account_bank_statement_import_camt_oca +#: model:ir.ui.view,arch_db:account_bank_statement_import_camt_oca.account_bank_statement_import_view msgid "CAMT" msgstr "CAMT" -#. module: account_bank_statement_import_camt -#: model:ir.model.fields,field_description:account_bank_statement_import_camt.field_account_bank_statement_import_camt_parser_display_name +#. module: account_bank_statement_import_camt_oca +#: model:ir.model.fields,field_description:account_bank_statement_import_camt_oca.field_account_bank_statement_import_camt_oca_parser_display_name msgid "Display Name" msgstr "Nombre a mostrar" -#. module: account_bank_statement_import_camt -#: model:ir.model.fields,field_description:account_bank_statement_import_camt.field_account_bank_statement_import_camt_parser_id +#. module: account_bank_statement_import_camt_oca +#: model:ir.model.fields,field_description:account_bank_statement_import_camt_oca.field_account_bank_statement_import_camt_oca_parser_id msgid "ID" msgstr "ID" -#. module: account_bank_statement_import_camt -#: model:ir.model,name:account_bank_statement_import_camt.model_account_bank_statement_import +#. module: account_bank_statement_import_camt_oca +#: model:ir.model,name:account_bank_statement_import_camt_oca.model_account_bank_statement_import msgid "Import Bank Statement" msgstr "Importar extracto bancario" -#. module: account_bank_statement_import_camt -#: model:ir.model.fields,field_description:account_bank_statement_import_camt.field_account_bank_statement_import_camt_parser___last_update +#. module: account_bank_statement_import_camt_oca +#: model:ir.model.fields,field_description:account_bank_statement_import_camt_oca.field_account_bank_statement_import_camt_oca_parser___last_update msgid "Last Modified on" msgstr "Última modificación en" -#. module: account_bank_statement_import_camt -#: model:ir.model,name:account_bank_statement_import_camt.model_account_bank_statement_import_camt_parser +#. module: account_bank_statement_import_camt_oca +#: model:ir.model,name:account_bank_statement_import_camt_oca.model_account_bank_statement_import_camt_oca_parser msgid "account.bank.statement.import.camt.parser" msgstr "account.bank.statement.import.camt.parser" -#. module: account_bank_statement_import_camt -#: model:ir.ui.view,arch_db:account_bank_statement_import_camt.account_bank_statement_import_view +#. module: account_bank_statement_import_camt_oca +#: model:ir.ui.view,arch_db:account_bank_statement_import_camt_oca.account_bank_statement_import_view msgid "zipped CAMT" msgstr "CAMT en .zip" diff --git a/account_bank_statement_import_camt/i18n/fi.po b/account_bank_statement_import_camt_oca/i18n/fi.po similarity index 60% rename from account_bank_statement_import_camt/i18n/fi.po rename to account_bank_statement_import_camt_oca/i18n/fi.po index 09b901e..f91f6c9 100644 --- a/account_bank_statement_import_camt/i18n/fi.po +++ b/account_bank_statement_import_camt_oca/i18n/fi.po @@ -1,7 +1,7 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: -# * account_bank_statement_import_camt -# +# * account_bank_statement_import_camt_oca +# # Translators: # Jarmo Kortetjärvi , 2017 msgid "" @@ -18,17 +18,17 @@ msgstr "" "Language: fi\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" -#. module: account_bank_statement_import_camt -#: model:ir.ui.view,arch_db:account_bank_statement_import_camt.account_bank_statement_import_view +#. module: account_bank_statement_import_camt_oca +#: model:ir.ui.view,arch_db:account_bank_statement_import_camt_oca.account_bank_statement_import_view msgid "CAMT" msgstr "" -#. module: account_bank_statement_import_camt -#: model:ir.model,name:account_bank_statement_import_camt.model_account_bank_statement_import +#. module: account_bank_statement_import_camt_oca +#: model:ir.model,name:account_bank_statement_import_camt_oca.model_account_bank_statement_import msgid "Import Bank Statement" msgstr "Tuo pankkiaineisto" -#. module: account_bank_statement_import_camt -#: model:ir.ui.view,arch_db:account_bank_statement_import_camt.account_bank_statement_import_view +#. module: account_bank_statement_import_camt_oca +#: model:ir.ui.view,arch_db:account_bank_statement_import_camt_oca.account_bank_statement_import_view msgid "zipped CAMT" msgstr "" diff --git a/account_bank_statement_import_camt/i18n/fr.po b/account_bank_statement_import_camt_oca/i18n/fr.po similarity index 53% rename from account_bank_statement_import_camt/i18n/fr.po rename to account_bank_statement_import_camt_oca/i18n/fr.po index 96f6d63..11f802f 100644 --- a/account_bank_statement_import_camt/i18n/fr.po +++ b/account_bank_statement_import_camt_oca/i18n/fr.po @@ -1,7 +1,7 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: -# * account_bank_statement_import_camt -# +# * account_bank_statement_import_camt_oca +# # Translators: # Quentin THEURET , 2017 # OCA Transbot , 2017 @@ -19,37 +19,37 @@ msgstr "" "Language: fr\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" -#. module: account_bank_statement_import_camt -#: model:ir.ui.view,arch_db:account_bank_statement_import_camt.account_bank_statement_import_view +#. module: account_bank_statement_import_camt_oca +#: model:ir.ui.view,arch_db:account_bank_statement_import_camt_oca.account_bank_statement_import_view msgid "CAMT" msgstr "CAMT" -#. module: account_bank_statement_import_camt -#: model:ir.model.fields,field_description:account_bank_statement_import_camt.field_account_bank_statement_import_camt_parser_display_name +#. module: account_bank_statement_import_camt_oca +#: model:ir.model.fields,field_description:account_bank_statement_import_camt_oca.field_account_bank_statement_import_camt_oca_parser_display_name msgid "Display Name" msgstr "Nom affiché" -#. module: account_bank_statement_import_camt -#: model:ir.model.fields,field_description:account_bank_statement_import_camt.field_account_bank_statement_import_camt_parser_id +#. module: account_bank_statement_import_camt_oca +#: model:ir.model.fields,field_description:account_bank_statement_import_camt_oca.field_account_bank_statement_import_camt_oca_parser_id msgid "ID" msgstr "ID" -#. module: account_bank_statement_import_camt -#: model:ir.model,name:account_bank_statement_import_camt.model_account_bank_statement_import +#. module: account_bank_statement_import_camt_oca +#: model:ir.model,name:account_bank_statement_import_camt_oca.model_account_bank_statement_import msgid "Import Bank Statement" msgstr "Importer Relevé Bancaire" -#. module: account_bank_statement_import_camt -#: model:ir.model.fields,field_description:account_bank_statement_import_camt.field_account_bank_statement_import_camt_parser___last_update +#. module: account_bank_statement_import_camt_oca +#: model:ir.model.fields,field_description:account_bank_statement_import_camt_oca.field_account_bank_statement_import_camt_oca_parser___last_update msgid "Last Modified on" msgstr "Dernière modification le" -#. module: account_bank_statement_import_camt -#: model:ir.model,name:account_bank_statement_import_camt.model_account_bank_statement_import_camt_parser +#. module: account_bank_statement_import_camt_oca +#: model:ir.model,name:account_bank_statement_import_camt_oca.model_account_bank_statement_import_camt_oca_parser msgid "account.bank.statement.import.camt.parser" msgstr "" -#. module: account_bank_statement_import_camt -#: model:ir.ui.view,arch_db:account_bank_statement_import_camt.account_bank_statement_import_view +#. module: account_bank_statement_import_camt_oca +#: model:ir.ui.view,arch_db:account_bank_statement_import_camt_oca.account_bank_statement_import_view msgid "zipped CAMT" msgstr "CAMT zippé" diff --git a/account_bank_statement_import_camt/i18n/fr_CH.po b/account_bank_statement_import_camt_oca/i18n/fr_CH.po similarity index 60% rename from account_bank_statement_import_camt/i18n/fr_CH.po rename to account_bank_statement_import_camt_oca/i18n/fr_CH.po index 3b8e813..4a5d587 100644 --- a/account_bank_statement_import_camt/i18n/fr_CH.po +++ b/account_bank_statement_import_camt_oca/i18n/fr_CH.po @@ -1,7 +1,7 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: -# * account_bank_statement_import_camt -# +# * account_bank_statement_import_camt_oca +# # Translators: # OCA Transbot , 2016 msgid "" @@ -18,17 +18,17 @@ msgstr "" "Language: fr_CH\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" -#. module: account_bank_statement_import_camt -#: model:ir.ui.view,arch_db:account_bank_statement_import_camt.account_bank_statement_import_view +#. module: account_bank_statement_import_camt_oca +#: model:ir.ui.view,arch_db:account_bank_statement_import_camt_oca.account_bank_statement_import_view msgid "CAMT" msgstr "" -#. module: account_bank_statement_import_camt -#: model:ir.model,name:account_bank_statement_import_camt.model_account_bank_statement_import +#. module: account_bank_statement_import_camt_oca +#: model:ir.model,name:account_bank_statement_import_camt_oca.model_account_bank_statement_import msgid "Import Bank Statement" msgstr "Importer Relevé" -#. module: account_bank_statement_import_camt -#: model:ir.ui.view,arch_db:account_bank_statement_import_camt.account_bank_statement_import_view +#. module: account_bank_statement_import_camt_oca +#: model:ir.ui.view,arch_db:account_bank_statement_import_camt_oca.account_bank_statement_import_view msgid "zipped CAMT" msgstr "" diff --git a/account_bank_statement_import_camt/i18n/gl.po b/account_bank_statement_import_camt_oca/i18n/gl.po similarity index 60% rename from account_bank_statement_import_camt/i18n/gl.po rename to account_bank_statement_import_camt_oca/i18n/gl.po index 7ac52f6..b8d5ab4 100644 --- a/account_bank_statement_import_camt/i18n/gl.po +++ b/account_bank_statement_import_camt_oca/i18n/gl.po @@ -1,7 +1,7 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: -# * account_bank_statement_import_camt -# +# * account_bank_statement_import_camt_oca +# # Translators: # Alejandro Santana , 2016 msgid "" @@ -18,17 +18,17 @@ msgstr "" "Language: gl\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" -#. module: account_bank_statement_import_camt -#: model:ir.ui.view,arch_db:account_bank_statement_import_camt.account_bank_statement_import_view +#. module: account_bank_statement_import_camt_oca +#: model:ir.ui.view,arch_db:account_bank_statement_import_camt_oca.account_bank_statement_import_view msgid "CAMT" msgstr "" -#. module: account_bank_statement_import_camt -#: model:ir.model,name:account_bank_statement_import_camt.model_account_bank_statement_import +#. module: account_bank_statement_import_camt_oca +#: model:ir.model,name:account_bank_statement_import_camt_oca.model_account_bank_statement_import msgid "Import Bank Statement" msgstr "Importar extracto bancario" -#. module: account_bank_statement_import_camt -#: model:ir.ui.view,arch_db:account_bank_statement_import_camt.account_bank_statement_import_view +#. module: account_bank_statement_import_camt_oca +#: model:ir.ui.view,arch_db:account_bank_statement_import_camt_oca.account_bank_statement_import_view msgid "zipped CAMT" msgstr "" diff --git a/account_bank_statement_import_camt/i18n/hr.po b/account_bank_statement_import_camt_oca/i18n/hr.po similarity index 53% rename from account_bank_statement_import_camt/i18n/hr.po rename to account_bank_statement_import_camt_oca/i18n/hr.po index 967d3a9..b8d38f5 100644 --- a/account_bank_statement_import_camt/i18n/hr.po +++ b/account_bank_statement_import_camt_oca/i18n/hr.po @@ -1,7 +1,7 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: -# * account_bank_statement_import_camt -# +# * account_bank_statement_import_camt_oca +# # Translators: # Bole , 2018 msgid "" @@ -18,37 +18,37 @@ msgstr "" "Language: hr\n" "Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" -#. module: account_bank_statement_import_camt -#: model:ir.ui.view,arch_db:account_bank_statement_import_camt.account_bank_statement_import_view +#. module: account_bank_statement_import_camt_oca +#: model:ir.ui.view,arch_db:account_bank_statement_import_camt_oca.account_bank_statement_import_view msgid "CAMT" msgstr "CAMT" -#. module: account_bank_statement_import_camt -#: model:ir.model.fields,field_description:account_bank_statement_import_camt.field_account_bank_statement_import_camt_parser_display_name +#. module: account_bank_statement_import_camt_oca +#: model:ir.model.fields,field_description:account_bank_statement_import_camt_oca.field_account_bank_statement_import_camt_oca_parser_display_name msgid "Display Name" msgstr "Naziv" -#. module: account_bank_statement_import_camt -#: model:ir.model.fields,field_description:account_bank_statement_import_camt.field_account_bank_statement_import_camt_parser_id +#. module: account_bank_statement_import_camt_oca +#: model:ir.model.fields,field_description:account_bank_statement_import_camt_oca.field_account_bank_statement_import_camt_oca_parser_id msgid "ID" msgstr "ID" -#. module: account_bank_statement_import_camt -#: model:ir.model,name:account_bank_statement_import_camt.model_account_bank_statement_import +#. module: account_bank_statement_import_camt_oca +#: model:ir.model,name:account_bank_statement_import_camt_oca.model_account_bank_statement_import msgid "Import Bank Statement" msgstr "Uvoz bankovnog izvoda" -#. module: account_bank_statement_import_camt -#: model:ir.model.fields,field_description:account_bank_statement_import_camt.field_account_bank_statement_import_camt_parser___last_update +#. module: account_bank_statement_import_camt_oca +#: model:ir.model.fields,field_description:account_bank_statement_import_camt_oca.field_account_bank_statement_import_camt_oca_parser___last_update msgid "Last Modified on" msgstr "Zadnje modificirano" -#. module: account_bank_statement_import_camt -#: model:ir.model,name:account_bank_statement_import_camt.model_account_bank_statement_import_camt_parser +#. module: account_bank_statement_import_camt_oca +#: model:ir.model,name:account_bank_statement_import_camt_oca.model_account_bank_statement_import_camt_oca_parser msgid "account.bank.statement.import.camt.parser" msgstr "account.bank.statement.import.camt.parser" -#. module: account_bank_statement_import_camt -#: model:ir.ui.view,arch_db:account_bank_statement_import_camt.account_bank_statement_import_view +#. module: account_bank_statement_import_camt_oca +#: model:ir.ui.view,arch_db:account_bank_statement_import_camt_oca.account_bank_statement_import_view msgid "zipped CAMT" msgstr "kompresirani CAMT" diff --git a/account_bank_statement_import_camt/i18n/lt_LT.po b/account_bank_statement_import_camt_oca/i18n/lt_LT.po similarity index 79% rename from account_bank_statement_import_camt/i18n/lt_LT.po rename to account_bank_statement_import_camt_oca/i18n/lt_LT.po index 7207693..0820966 100644 --- a/account_bank_statement_import_camt/i18n/lt_LT.po +++ b/account_bank_statement_import_camt_oca/i18n/lt_LT.po @@ -1,7 +1,7 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: -# * account_bank_statement_import_camt -# +# * account_bank_statement_import_camt_oca +# # Translators: msgid "" msgstr "" @@ -17,7 +17,7 @@ msgstr "" "Language: lt_LT\n" "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && (n%100<10 || n%100>=20) ? 1 : 2);\n" -#. module: account_bank_statement_import_camt -#: model:ir.model,name:account_bank_statement_import_camt.model_account_bank_statement_import +#. module: account_bank_statement_import_camt_oca +#: model:ir.model,name:account_bank_statement_import_camt_oca.model_account_bank_statement_import msgid "Import Bank Statement" msgstr "Importuoti banko išrašą" diff --git a/account_bank_statement_import_camt/i18n/nb_NO.po b/account_bank_statement_import_camt_oca/i18n/nb_NO.po similarity index 61% rename from account_bank_statement_import_camt/i18n/nb_NO.po rename to account_bank_statement_import_camt_oca/i18n/nb_NO.po index 8b0659a..ad504a0 100644 --- a/account_bank_statement_import_camt/i18n/nb_NO.po +++ b/account_bank_statement_import_camt_oca/i18n/nb_NO.po @@ -1,7 +1,7 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: -# * account_bank_statement_import_camt -# +# * account_bank_statement_import_camt_oca +# # Translators: # Imre Kristoffer Eilertsen , 2016 msgid "" @@ -18,17 +18,17 @@ msgstr "" "Language: nb_NO\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" -#. module: account_bank_statement_import_camt -#: model:ir.ui.view,arch_db:account_bank_statement_import_camt.account_bank_statement_import_view +#. module: account_bank_statement_import_camt_oca +#: model:ir.ui.view,arch_db:account_bank_statement_import_camt_oca.account_bank_statement_import_view msgid "CAMT" msgstr "" -#. module: account_bank_statement_import_camt -#: model:ir.model,name:account_bank_statement_import_camt.model_account_bank_statement_import +#. module: account_bank_statement_import_camt_oca +#: model:ir.model,name:account_bank_statement_import_camt_oca.model_account_bank_statement_import msgid "Import Bank Statement" msgstr "Importer bankutsagn" -#. module: account_bank_statement_import_camt -#: model:ir.ui.view,arch_db:account_bank_statement_import_camt.account_bank_statement_import_view +#. module: account_bank_statement_import_camt_oca +#: model:ir.ui.view,arch_db:account_bank_statement_import_camt_oca.account_bank_statement_import_view msgid "zipped CAMT" msgstr "" diff --git a/account_bank_statement_import_camt/i18n/nl.po b/account_bank_statement_import_camt_oca/i18n/nl.po similarity index 79% rename from account_bank_statement_import_camt/i18n/nl.po rename to account_bank_statement_import_camt_oca/i18n/nl.po index 408e305..fa6dec9 100644 --- a/account_bank_statement_import_camt/i18n/nl.po +++ b/account_bank_statement_import_camt_oca/i18n/nl.po @@ -1,7 +1,7 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: -# * account_bank_statement_import_camt -# +# * account_bank_statement_import_camt_oca +# # Translators: # Erwin van der Ploeg , 2015 msgid "" @@ -18,7 +18,7 @@ msgstr "" "Language: nl\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" -#. module: account_bank_statement_import_camt -#: model:ir.model,name:account_bank_statement_import_camt.model_account_bank_statement_import +#. module: account_bank_statement_import_camt_oca +#: model:ir.model,name:account_bank_statement_import_camt_oca.model_account_bank_statement_import msgid "Import Bank Statement" msgstr "Importeer bankafschrift" diff --git a/account_bank_statement_import_camt/i18n/pt_BR.po b/account_bank_statement_import_camt_oca/i18n/pt_BR.po similarity index 78% rename from account_bank_statement_import_camt/i18n/pt_BR.po rename to account_bank_statement_import_camt_oca/i18n/pt_BR.po index a56eec5..c27fa00 100644 --- a/account_bank_statement_import_camt/i18n/pt_BR.po +++ b/account_bank_statement_import_camt_oca/i18n/pt_BR.po @@ -1,7 +1,7 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: -# * account_bank_statement_import_camt -# +# * account_bank_statement_import_camt_oca +# # Translators: msgid "" msgstr "" @@ -17,7 +17,7 @@ msgstr "" "Language: pt_BR\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" -#. module: account_bank_statement_import_camt -#: model:ir.model,name:account_bank_statement_import_camt.model_account_bank_statement_import +#. module: account_bank_statement_import_camt_oca +#: model:ir.model,name:account_bank_statement_import_camt_oca.model_account_bank_statement_import msgid "Import Bank Statement" msgstr "Importar Extrato Bancário" diff --git a/account_bank_statement_import_camt/i18n/pt_PT.po b/account_bank_statement_import_camt_oca/i18n/pt_PT.po similarity index 77% rename from account_bank_statement_import_camt/i18n/pt_PT.po rename to account_bank_statement_import_camt_oca/i18n/pt_PT.po index 7b0f8e8..62f2b77 100644 --- a/account_bank_statement_import_camt/i18n/pt_PT.po +++ b/account_bank_statement_import_camt_oca/i18n/pt_PT.po @@ -1,7 +1,7 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: -# * account_bank_statement_import_camt -# +# * account_bank_statement_import_camt_oca +# # Translators: msgid "" msgstr "" @@ -17,7 +17,7 @@ msgstr "" "Language: pt_PT\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" -#. module: account_bank_statement_import_camt -#: model:ir.model,name:account_bank_statement_import_camt.model_account_bank_statement_import +#. module: account_bank_statement_import_camt_oca +#: model:ir.model,name:account_bank_statement_import_camt_oca.model_account_bank_statement_import msgid "Import Bank Statement" msgstr "Importar Extrato Bancário" diff --git a/account_bank_statement_import_camt/i18n/sl.po b/account_bank_statement_import_camt_oca/i18n/sl.po similarity index 79% rename from account_bank_statement_import_camt/i18n/sl.po rename to account_bank_statement_import_camt_oca/i18n/sl.po index 4aa623d..fe1211d 100644 --- a/account_bank_statement_import_camt/i18n/sl.po +++ b/account_bank_statement_import_camt_oca/i18n/sl.po @@ -1,7 +1,7 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: -# * account_bank_statement_import_camt -# +# * account_bank_statement_import_camt_oca +# # Translators: msgid "" msgstr "" @@ -17,7 +17,7 @@ msgstr "" "Language: sl\n" "Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3);\n" -#. module: account_bank_statement_import_camt -#: model:ir.model,name:account_bank_statement_import_camt.model_account_bank_statement_import +#. module: account_bank_statement_import_camt_oca +#: model:ir.model,name:account_bank_statement_import_camt_oca.model_account_bank_statement_import msgid "Import Bank Statement" msgstr "Uvoz bančnega izpiska" diff --git a/account_bank_statement_import_camt/models/__init__.py b/account_bank_statement_import_camt_oca/models/__init__.py similarity index 100% rename from account_bank_statement_import_camt/models/__init__.py rename to account_bank_statement_import_camt_oca/models/__init__.py diff --git a/account_bank_statement_import_camt/models/account_bank_statement_import.py b/account_bank_statement_import_camt_oca/models/account_bank_statement_import.py similarity index 96% rename from account_bank_statement_import_camt/models/account_bank_statement_import.py rename to account_bank_statement_import_camt_oca/models/account_bank_statement_import.py index 27b26af..f3ec1a5 100644 --- a/account_bank_statement_import_camt/models/account_bank_statement_import.py +++ b/account_bank_statement_import_camt_oca/models/account_bank_statement_import.py @@ -32,7 +32,7 @@ class AccountBankStatementImport(models.TransientModel): ) transactions.extend(new) return currency, account_number, transactions - except (zipfile.BadZipfile, ValueError): + except (zipfile.BadZipFile, ValueError): pass # Not a camt file, returning super will call next candidate: _logger.debug("Statement file was not a camt file.", diff --git a/account_bank_statement_import_camt/models/parser.py b/account_bank_statement_import_camt_oca/models/parser.py similarity index 100% rename from account_bank_statement_import_camt/models/parser.py rename to account_bank_statement_import_camt_oca/models/parser.py diff --git a/account_bank_statement_import_camt/test_files/golden-camt053-txdtls.pydata b/account_bank_statement_import_camt_oca/test_files/golden-camt053-txdtls.pydata similarity index 100% rename from account_bank_statement_import_camt/test_files/golden-camt053-txdtls.pydata rename to account_bank_statement_import_camt_oca/test_files/golden-camt053-txdtls.pydata diff --git a/account_bank_statement_import_camt/test_files/golden-camt053.pydata b/account_bank_statement_import_camt_oca/test_files/golden-camt053.pydata similarity index 100% rename from account_bank_statement_import_camt/test_files/golden-camt053.pydata rename to account_bank_statement_import_camt_oca/test_files/golden-camt053.pydata diff --git a/account_bank_statement_import_camt/test_files/test-camt053 b/account_bank_statement_import_camt_oca/test_files/test-camt053 similarity index 100% rename from account_bank_statement_import_camt/test_files/test-camt053 rename to account_bank_statement_import_camt_oca/test_files/test-camt053 diff --git a/account_bank_statement_import_camt/test_files/test-camt053-txdtls b/account_bank_statement_import_camt_oca/test_files/test-camt053-txdtls similarity index 100% rename from account_bank_statement_import_camt/test_files/test-camt053-txdtls rename to account_bank_statement_import_camt_oca/test_files/test-camt053-txdtls diff --git a/account_bank_statement_import_camt/test_files/test-camt053.zip b/account_bank_statement_import_camt_oca/test_files/test-camt053.zip similarity index 100% rename from account_bank_statement_import_camt/test_files/test-camt053.zip rename to account_bank_statement_import_camt_oca/test_files/test-camt053.zip diff --git a/account_bank_statement_import_camt/tests/__init__.py b/account_bank_statement_import_camt_oca/tests/__init__.py similarity index 100% rename from account_bank_statement_import_camt/tests/__init__.py rename to account_bank_statement_import_camt_oca/tests/__init__.py diff --git a/account_bank_statement_import_camt_oca/tests/test_import_bank_statement.py b/account_bank_statement_import_camt_oca/tests/test_import_bank_statement.py new file mode 100644 index 0000000..d96b051 --- /dev/null +++ b/account_bank_statement_import_camt_oca/tests/test_import_bank_statement.py @@ -0,0 +1,127 @@ +"""Run test to import camt.053 import.""" +# © 2013-2016 Therp BV +# Copyright 2017 Open Net Sàrl +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +import base64 +import difflib +import pprint +import tempfile + + +from odoo.tests.common import TransactionCase +from odoo.modules.module import get_module_resource + + +class TestParser(TransactionCase): + """Tests for the camt parser itself.""" + def setUp(self): + super(TestParser, self).setUp() + self.parser = self.env['account.bank.statement.import.camt.parser'] + + def _do_parse_test(self, inputfile, goldenfile): + testfile = get_module_resource( + 'account_bank_statement_import_camt_oca', + 'test_files', + inputfile, + ) + with open(testfile, 'rb') as data: + res = self.parser.parse(data.read()) + with tempfile.NamedTemporaryFile(mode='w+', + suffix='.pydata') as temp: + pprint.pprint(res, temp, width=160) + goldenfile_res = get_module_resource( + 'account_bank_statement_import_camt_oca', + 'test_files', + goldenfile, + ) + with open(goldenfile_res, 'r') as golden: + temp.seek(0) + diff = list( + difflib.unified_diff(golden.readlines(), + temp.readlines(), + golden.name, + temp.name)) + if len(diff) > 2: + self.fail( + "actual output doesn't match expected " + + "output:\n%s" % + "".join(diff)) + + def test_parse(self): + self._do_parse_test( + 'test-camt053', + 'golden-camt053.pydata') + + def test_parse_txdtls(self): + self._do_parse_test( + 'test-camt053-txdtls', + 'golden-camt053-txdtls.pydata') + + +class TestImport(TransactionCase): + """Run test to import camt import.""" + transactions = [ + { + 'account_number': 'NL46ABNA0499998748', + 'amount': -754.25, + 'date': '2014-01-05', + 'ref': '435005714488-ABNO33052620', + }, + ] + + def setUp(self): + super(TestImport, self).setUp() + bank = self.env['res.partner.bank'].create({ + 'acc_number': 'NL77ABNA0574908765', + '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, + }) + self.env['account.journal'].create({ + 'name': 'Bank Journal - (test camt)', + 'code': 'TBNKCAMT', + 'type': 'bank', + 'bank_account_id': bank.id, + }) + + def test_statement_import(self): + """Test correct creation of single statement.""" + testfile = get_module_resource( + 'account_bank_statement_import_camt_oca', + 'test_files', + 'test-camt053', + ) + with open(testfile, 'rb') as datafile: + action = self.env['account.bank.statement.import'].create({ + 'data_file': base64.b64encode(datafile.read()) + }).import_file() + + for statement in self.env['account.bank.statement'].browse( + action['context']['statement_ids'] + ): + self.assertTrue(any( + all( + line[key] == self.transactions[0][key] + for key in ['amount', 'date', 'ref'] + ) and + line.bank_account_id.acc_number == + self.transactions[0]['account_number'] + for line in statement.line_ids + )) + + def test_zip_import(self): + """Test import of multiple statements from zip file.""" + testfile = get_module_resource( + 'account_bank_statement_import_camt_oca', + 'test_files', + 'test-camt053.zip', + ) + with open(testfile, 'rb') as datafile: + action = self.env['account.bank.statement.import'].create({ + 'data_file': base64.b64encode(datafile.read()), + }).import_file() + + for statement in self.env['account.bank.statement'].browse( + action['context']['statement_ids'] + ): + self.assertTrue(statement.line_ids) diff --git a/account_bank_statement_import_camt/views/account_bank_statement_import.xml b/account_bank_statement_import_camt_oca/views/account_bank_statement_import.xml similarity index 100% rename from account_bank_statement_import_camt/views/account_bank_statement_import.xml rename to account_bank_statement_import_camt_oca/views/account_bank_statement_import.xml