Browse Source

Rename module

Also:
- Use context managers for file opening/closing in tests
- Changed use of deprecated `BadZipfile` exception
- Removed debugging code left by mistake
pull/158/head
Maxence Groine 7 years ago
parent
commit
cc37448d5d
  1. 128
      account_bank_statement_import_camt/tests/test_import_bank_statement.py
  2. 0
      account_bank_statement_import_camt_oca/README.rst
  3. 0
      account_bank_statement_import_camt_oca/__init__.py
  4. 0
      account_bank_statement_import_camt_oca/__manifest__.py
  5. 6
      account_bank_statement_import_camt_oca/i18n/de.po
  6. 32
      account_bank_statement_import_camt_oca/i18n/es.po
  7. 16
      account_bank_statement_import_camt_oca/i18n/fi.po
  8. 32
      account_bank_statement_import_camt_oca/i18n/fr.po
  9. 16
      account_bank_statement_import_camt_oca/i18n/fr_CH.po
  10. 16
      account_bank_statement_import_camt_oca/i18n/gl.po
  11. 32
      account_bank_statement_import_camt_oca/i18n/hr.po
  12. 8
      account_bank_statement_import_camt_oca/i18n/lt_LT.po
  13. 16
      account_bank_statement_import_camt_oca/i18n/nb_NO.po
  14. 8
      account_bank_statement_import_camt_oca/i18n/nl.po
  15. 8
      account_bank_statement_import_camt_oca/i18n/pt_BR.po
  16. 8
      account_bank_statement_import_camt_oca/i18n/pt_PT.po
  17. 8
      account_bank_statement_import_camt_oca/i18n/sl.po
  18. 0
      account_bank_statement_import_camt_oca/models/__init__.py
  19. 2
      account_bank_statement_import_camt_oca/models/account_bank_statement_import.py
  20. 0
      account_bank_statement_import_camt_oca/models/parser.py
  21. 0
      account_bank_statement_import_camt_oca/test_files/golden-camt053-txdtls.pydata
  22. 0
      account_bank_statement_import_camt_oca/test_files/golden-camt053.pydata
  23. 0
      account_bank_statement_import_camt_oca/test_files/test-camt053
  24. 0
      account_bank_statement_import_camt_oca/test_files/test-camt053-txdtls
  25. 0
      account_bank_statement_import_camt_oca/test_files/test-camt053.zip
  26. 0
      account_bank_statement_import_camt_oca/tests/__init__.py
  27. 127
      account_bank_statement_import_camt_oca/tests/test_import_bank_statement.py
  28. 0
      account_bank_statement_import_camt_oca/views/account_bank_statement_import.xml

128
account_bank_statement_import_camt/tests/test_import_bank_statement.py

@ -1,128 +0,0 @@
"""Run test to import camt.053 import."""
# © 2013-2016 Therp BV <http://therp.nl>
# 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)

0
account_bank_statement_import_camt/README.rst → account_bank_statement_import_camt_oca/README.rst

0
account_bank_statement_import_camt/__init__.py → account_bank_statement_import_camt_oca/__init__.py

0
account_bank_statement_import_camt/__manifest__.py → account_bank_statement_import_camt_oca/__manifest__.py

6
account_bank_statement_import_camt/i18n/de.po → 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"

32
account_bank_statement_import_camt/i18n/es.po → 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 <transbot@odoo-community.org>, 2017
# enjolras <yo@miguelrevilla.com>, 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"

16
account_bank_statement_import_camt/i18n/fi.po → 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 <jarmo.kortetjarvi@gmail.com>, 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 ""

32
account_bank_statement_import_camt/i18n/fr.po → 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 <odoo@kerpeo.com>, 2017
# OCA Transbot <transbot@odoo-community.org>, 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é"

16
account_bank_statement_import_camt/i18n/fr_CH.po → 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 <transbot@odoo-community.org>, 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 ""

16
account_bank_statement_import_camt/i18n/gl.po → 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 <alejandrosantana@anubia.es>, 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 ""

32
account_bank_statement_import_camt/i18n/hr.po → 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 <bole@dajmi5.com>, 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"

8
account_bank_statement_import_camt/i18n/lt_LT.po → 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šą"

16
account_bank_statement_import_camt/i18n/nb_NO.po → 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 <imreeil42@gmail.com>, 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 ""

8
account_bank_statement_import_camt/i18n/nl.po → 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 <erwin@bas-solutions.nl>, 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"

8
account_bank_statement_import_camt/i18n/pt_BR.po → 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"

8
account_bank_statement_import_camt/i18n/pt_PT.po → 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"

8
account_bank_statement_import_camt/i18n/sl.po → 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"

0
account_bank_statement_import_camt/models/__init__.py → account_bank_statement_import_camt_oca/models/__init__.py

2
account_bank_statement_import_camt/models/account_bank_statement_import.py → 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.",

0
account_bank_statement_import_camt/models/parser.py → account_bank_statement_import_camt_oca/models/parser.py

0
account_bank_statement_import_camt/test_files/golden-camt053-txdtls.pydata → account_bank_statement_import_camt_oca/test_files/golden-camt053-txdtls.pydata

0
account_bank_statement_import_camt/test_files/golden-camt053.pydata → account_bank_statement_import_camt_oca/test_files/golden-camt053.pydata

0
account_bank_statement_import_camt/test_files/test-camt053 → account_bank_statement_import_camt_oca/test_files/test-camt053

0
account_bank_statement_import_camt/test_files/test-camt053-txdtls → account_bank_statement_import_camt_oca/test_files/test-camt053-txdtls

0
account_bank_statement_import_camt/test_files/test-camt053.zip → account_bank_statement_import_camt_oca/test_files/test-camt053.zip

0
account_bank_statement_import_camt/tests/__init__.py → account_bank_statement_import_camt_oca/tests/__init__.py

127
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 <http://therp.nl>
# 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)

0
account_bank_statement_import_camt/views/account_bank_statement_import.xml → account_bank_statement_import_camt_oca/views/account_bank_statement_import.xml

Loading…
Cancel
Save