odoo-addon-account-statement-import-camt 16.0.1.0.0.7__py3-none-any.whl → 16.0.1.0.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- odoo/addons/account_statement_import_camt/README.rst +1 -1
- odoo/addons/account_statement_import_camt/__manifest__.py +1 -1
- odoo/addons/account_statement_import_camt/i18n/account_statement_import_camt.pot +1 -0
- odoo/addons/account_statement_import_camt/models/parser.py +8 -1
- odoo/addons/account_statement_import_camt/static/description/index.html +1 -2
- odoo/addons/account_statement_import_camt/test_files/golden-camt053-txdtls.pydata +2 -2
- odoo/addons/account_statement_import_camt/tests/test_import_bank_statement.py +63 -25
- {odoo_addon_account_statement_import_camt-16.0.1.0.0.7.dist-info → odoo_addon_account_statement_import_camt-16.0.1.0.2.dist-info}/METADATA +2 -2
- {odoo_addon_account_statement_import_camt-16.0.1.0.0.7.dist-info → odoo_addon_account_statement_import_camt-16.0.1.0.2.dist-info}/RECORD +11 -11
- {odoo_addon_account_statement_import_camt-16.0.1.0.0.7.dist-info → odoo_addon_account_statement_import_camt-16.0.1.0.2.dist-info}/WHEEL +1 -1
- {odoo_addon_account_statement_import_camt-16.0.1.0.0.7.dist-info → odoo_addon_account_statement_import_camt-16.0.1.0.2.dist-info}/top_level.txt +0 -0
|
@@ -7,7 +7,7 @@ CAMT Format Bank Statements Import
|
|
|
7
7
|
!! This file is generated by oca-gen-addon-readme !!
|
|
8
8
|
!! changes will be overwritten. !!
|
|
9
9
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
10
|
-
!! source digest: sha256:
|
|
10
|
+
!! source digest: sha256:5ffe9c10ed054fd24dee2d72407455312658c557b4578cf842c7291a58d4d0c8
|
|
11
11
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
12
12
|
|
|
13
13
|
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
|
3
3
|
{
|
|
4
4
|
"name": "CAMT Format Bank Statements Import",
|
|
5
|
-
"version": "16.0.1.0.
|
|
5
|
+
"version": "16.0.1.0.2",
|
|
6
6
|
"license": "AGPL-3",
|
|
7
7
|
"author": "Therp BV, Odoo Community Association (OCA)",
|
|
8
8
|
"website": "https://github.com/OCA/bank-statement-import",
|
|
@@ -28,6 +28,7 @@ msgstr ""
|
|
|
28
28
|
#. module: account_statement_import_camt
|
|
29
29
|
#. odoo-python
|
|
30
30
|
#: code:addons/account_statement_import_camt/models/parser.py:0
|
|
31
|
+
#: code:addons/account_statement_import_camt/models/parser.py:0
|
|
31
32
|
#, python-format
|
|
32
33
|
msgid "Additional Entry Information"
|
|
33
34
|
msgstr ""
|
|
@@ -61,7 +61,6 @@ class CamtParser(models.AbstractModel):
|
|
|
61
61
|
node,
|
|
62
62
|
[
|
|
63
63
|
"./ns:RmtInf/ns:Ustrd|./ns:RtrInf/ns:AddtlInf",
|
|
64
|
-
"./ns:AddtlNtryInf",
|
|
65
64
|
"./ns:Refs/ns:InstrId",
|
|
66
65
|
],
|
|
67
66
|
transaction,
|
|
@@ -329,6 +328,7 @@ class CamtParser(models.AbstractModel):
|
|
|
329
328
|
|
|
330
329
|
details_nodes = node.xpath("./ns:NtryDtls/ns:TxDtls", namespaces={"ns": ns})
|
|
331
330
|
if len(details_nodes) == 0:
|
|
331
|
+
self.amend_transaction(transaction)
|
|
332
332
|
self.generate_narration(transaction)
|
|
333
333
|
yield transaction
|
|
334
334
|
return
|
|
@@ -336,6 +336,7 @@ class CamtParser(models.AbstractModel):
|
|
|
336
336
|
for node in details_nodes:
|
|
337
337
|
transaction = transaction_base.copy()
|
|
338
338
|
self.parse_transaction_details(ns, node, transaction)
|
|
339
|
+
self.amend_transaction(transaction)
|
|
339
340
|
self.generate_narration(transaction)
|
|
340
341
|
yield transaction
|
|
341
342
|
|
|
@@ -456,3 +457,9 @@ class CamtParser(models.AbstractModel):
|
|
|
456
457
|
account_number = statement.pop("account_number")
|
|
457
458
|
statements.append(statement)
|
|
458
459
|
return currency, account_number, statements
|
|
460
|
+
|
|
461
|
+
def amend_transaction(self, transaction):
|
|
462
|
+
if transaction.get("payment_ref") == "/":
|
|
463
|
+
transaction["payment_ref"] = transaction["narration"].get(
|
|
464
|
+
"%s (AddtlNtryInf)" % _("Additional Entry Information"), "/"
|
|
465
|
+
)
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="utf-8"?>
|
|
2
1
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
3
2
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
4
3
|
<head>
|
|
@@ -367,7 +366,7 @@ ul.auto-toc {
|
|
|
367
366
|
!! This file is generated by oca-gen-addon-readme !!
|
|
368
367
|
!! changes will be overwritten. !!
|
|
369
368
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
370
|
-
!! source digest: sha256:
|
|
369
|
+
!! source digest: sha256:5ffe9c10ed054fd24dee2d72407455312658c557b4578cf842c7291a58d4d0c8
|
|
371
370
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
|
372
371
|
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/bank-statement-import/tree/16.0/account_statement_import_camt"><img alt="OCA/bank-statement-import" src="https://img.shields.io/badge/github-OCA%2Fbank--statement--import-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/bank-statement-import-16-0/bank-statement-import-16-0-account_statement_import_camt"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/bank-statement-import&target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
|
|
373
372
|
<p>Module to import SEPA CAMT.053 and CAMT.054 Format bank statement files.</p>
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
'Account Servicer Reference (Refs/AcctSvcrRef): 123456CHCAFEBABE\n'
|
|
21
21
|
'Postal Address (PstlAdr): Place Saint-François | 14 | 1003 | Lausanne | CH1',
|
|
22
22
|
'partner_name': 'Banque Cantonale Vaudoise',
|
|
23
|
-
'payment_ref': '
|
|
23
|
+
'payment_ref': 'CRÉDIT GROUPÉ BVR TRAITEMENT DU 22.03.2017 NUMÉRO CLIENT 01-70884-3 PAQUET ID: 123456CHCAFEBABE',
|
|
24
24
|
'ref': '302388292000011111111111111',
|
|
25
25
|
'transaction_type': 'PMNT-RCDT-VCOM'},
|
|
26
26
|
{'account_number': 'CH3333000000123456789',
|
|
@@ -39,6 +39,6 @@
|
|
|
39
39
|
'Account Servicer Reference (Refs/AcctSvcrRef): 123456CHCAFEBABE\n'
|
|
40
40
|
'Postal Address (PstlAdr): Place Saint-François | 14 | 1003 | Lausanne | CH2',
|
|
41
41
|
'partner_name': 'Banque Cantonale Vaudoise',
|
|
42
|
-
'payment_ref': '
|
|
42
|
+
'payment_ref': 'CRÉDIT GROUPÉ BVR TRAITEMENT DU 22.03.2017 NUMÉRO CLIENT 01-70884-3 PAQUET ID: 123456CHCAFEBABE',
|
|
43
43
|
'ref': '302388292000022222222222222',
|
|
44
44
|
'transaction_type': 'PMNT-RCDT-VCOM'}]}])
|
|
@@ -7,42 +7,80 @@ import difflib
|
|
|
7
7
|
import pprint
|
|
8
8
|
import tempfile
|
|
9
9
|
from datetime import date
|
|
10
|
+
from pathlib import Path
|
|
10
11
|
|
|
11
12
|
from odoo.modules.module import get_module_resource
|
|
12
13
|
from odoo.tests.common import TransactionCase
|
|
13
14
|
|
|
14
15
|
|
|
15
|
-
class
|
|
16
|
-
"""Tests for the camt parser itself."""
|
|
17
|
-
|
|
16
|
+
class TestParserCommon(TransactionCase):
|
|
18
17
|
@classmethod
|
|
19
18
|
def setUpClass(cls):
|
|
20
19
|
super().setUpClass()
|
|
21
20
|
cls.parser = cls.env["account.statement.import.camt.parser"]
|
|
22
21
|
|
|
23
|
-
def _do_parse_test(self, inputfile, goldenfile):
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
def _do_parse_test(self, inputfile, goldenfile, max_diff_count=None):
|
|
23
|
+
"""Imports ``inputfile`` and confronts its output against ``goldenfile`` data
|
|
24
|
+
|
|
25
|
+
An AssertionError is raised if max_diff_count < 0
|
|
26
|
+
|
|
27
|
+
:param inputfile: file to import and test
|
|
28
|
+
:type inputfile: Path or str
|
|
29
|
+
:param goldenfile: file to use for comparison (the expected values)
|
|
30
|
+
:type goldenfile: Path or str
|
|
31
|
+
:param max_diff_count: maximum nr of lines that can differ (default: 2)
|
|
32
|
+
:type max_diff_count: int
|
|
33
|
+
"""
|
|
34
|
+
max_diff_count = max_diff_count or 2
|
|
35
|
+
assert max_diff_count >= 0
|
|
36
|
+
diff = self._get_files_diffs(*map(self._to_filepath, (inputfile, goldenfile)))
|
|
37
|
+
self.assertLessEqual(
|
|
38
|
+
len(diff),
|
|
39
|
+
max_diff_count,
|
|
40
|
+
f"Actual output doesn't match expected output:\n{''.join(diff)}",
|
|
26
41
|
)
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
42
|
+
|
|
43
|
+
def _get_files_diffs(self, inputfile_path, goldenfile_path) -> list:
|
|
44
|
+
"""Creates diffs between ``inputfile_path`` and ``goldenfile_path`` data
|
|
45
|
+
|
|
46
|
+
:param inputfile_path: path for file to import and test
|
|
47
|
+
:type inputfile_path: Path
|
|
48
|
+
:param goldenfile_path: path for file to use for comparison (the expected values)
|
|
49
|
+
:type goldenfile_path: Path
|
|
50
|
+
"""
|
|
51
|
+
|
|
52
|
+
# Read the input file, store the actual imported values
|
|
53
|
+
with open(get_module_resource(*inputfile_path.parts), "rb") as inputf:
|
|
54
|
+
res = self.parser.parse(inputf.read())
|
|
55
|
+
# Read the output file, store the expected imported values
|
|
56
|
+
with open(get_module_resource(*goldenfile_path.parts), "r") as goldf:
|
|
57
|
+
gold_name, gold_lines = goldf.name, goldf.readlines()
|
|
58
|
+
# Save the imported values in a tmp file to compare them w/ the expected values
|
|
59
|
+
with tempfile.NamedTemporaryFile(mode="w+", suffix=".pydata") as tempf:
|
|
60
|
+
pprint.pprint(res, tempf, width=160)
|
|
61
|
+
tempf.seek(0)
|
|
62
|
+
out_name, out_lines = tempf.name, tempf.readlines()
|
|
63
|
+
# Return a list of diffs
|
|
64
|
+
return list(difflib.unified_diff(gold_lines, out_lines, gold_name, out_name))
|
|
65
|
+
|
|
66
|
+
def _to_filepath(self, file):
|
|
67
|
+
"""Converts ``obj`` to a ``pathlib.Path`` object
|
|
68
|
+
|
|
69
|
+
For backward compatibility: allows ``obj`` to be just a string representing only
|
|
70
|
+
a filename, and this method will convert it to filepath for files inside the
|
|
71
|
+
``test_files`` folder (this behavior was previously hardcoded in method
|
|
72
|
+
``TestParser._do_parse_test()``)
|
|
73
|
+
|
|
74
|
+
:param obj: the object to convert
|
|
75
|
+
:type obj: Path or str
|
|
76
|
+
"""
|
|
77
|
+
if isinstance(file, str) and len(Path(file).parts) == 1:
|
|
78
|
+
file = Path("account_statement_import_camt") / "test_files" / file
|
|
79
|
+
return Path(file)
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
class TestParser(TestParserCommon):
|
|
83
|
+
"""Tests for the camt parser itself."""
|
|
46
84
|
|
|
47
85
|
def test_parse(self):
|
|
48
86
|
self._do_parse_test("test-camt053", "golden-camt053.pydata")
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: odoo-addon-account-statement-import-camt
|
|
3
|
-
Version: 16.0.1.0.
|
|
3
|
+
Version: 16.0.1.0.2
|
|
4
4
|
Summary: CAMT Format Bank Statements Import
|
|
5
5
|
Home-page: https://github.com/OCA/bank-statement-import
|
|
6
6
|
Author: Therp BV, Odoo Community Association (OCA)
|
|
@@ -24,7 +24,7 @@ CAMT Format Bank Statements Import
|
|
|
24
24
|
!! This file is generated by oca-gen-addon-readme !!
|
|
25
25
|
!! changes will be overwritten. !!
|
|
26
26
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
27
|
-
!! source digest: sha256:
|
|
27
|
+
!! source digest: sha256:5ffe9c10ed054fd24dee2d72407455312658c557b4578cf842c7291a58d4d0c8
|
|
28
28
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
29
29
|
|
|
30
30
|
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
odoo/addons/account_statement_import_camt/README.rst,sha256=
|
|
1
|
+
odoo/addons/account_statement_import_camt/README.rst,sha256=EjxteDYP5A92UJic1S0E3tsoPfqtWDMb-vN9vawONoE,3421
|
|
2
2
|
odoo/addons/account_statement_import_camt/__init__.py,sha256=X9EJGOE2GtZbS0G82PtSXmWSZ_R8jEM0rlJTDliQjp4,21
|
|
3
|
-
odoo/addons/account_statement_import_camt/__manifest__.py,sha256=
|
|
4
|
-
odoo/addons/account_statement_import_camt/i18n/account_statement_import_camt.pot,sha256=
|
|
3
|
+
odoo/addons/account_statement_import_camt/__manifest__.py,sha256=XcZJD5EGmc9MnVvdyBpbPpmMzNafU1z-R8zoLkM2lcg,492
|
|
4
|
+
odoo/addons/account_statement_import_camt/i18n/account_statement_import_camt.pot,sha256=1QIY9BFl224v05F-up1yk97RSn0Ecp_Gj5UsxZfHB84,5835
|
|
5
5
|
odoo/addons/account_statement_import_camt/i18n/de.po,sha256=pNMF_ShipraFlQvc--hGsOZT_PyXWveKMAX9luptivY,6177
|
|
6
6
|
odoo/addons/account_statement_import_camt/i18n/es.po,sha256=OA6EzKvE1aIVRI2eH2lGEWFxH42y3kZFNrhvaCO5JJc,6983
|
|
7
7
|
odoo/addons/account_statement_import_camt/i18n/fa.po,sha256=PtrRjJw123B1SmQHj3nIfUG6MprES471g-wl9gJa5gc,6499
|
|
@@ -22,15 +22,15 @@ odoo/addons/account_statement_import_camt/models/account_bank_statement_line.py,
|
|
|
22
22
|
odoo/addons/account_statement_import_camt/models/account_journal.py,sha256=RE1k4mJNaWxTacwWrZEjlEI7b0HKByRXYCngR71_VYg,480
|
|
23
23
|
odoo/addons/account_statement_import_camt/models/account_statement_import.py,sha256=6w7m7-1eeWuo3juaVe6AloiuvDZnTkU4Zbs4Fm6KruY,1451
|
|
24
24
|
odoo/addons/account_statement_import_camt/models/bank_statement.py,sha256=JQIdhsLpU_Z4OPNTNvKN5dsAISeKR0Ls4LeCI_otGmo,406
|
|
25
|
-
odoo/addons/account_statement_import_camt/models/parser.py,sha256=
|
|
25
|
+
odoo/addons/account_statement_import_camt/models/parser.py,sha256=KodZbV3wzsYpjAgV-S3XCXyB89rys5LAT8j1joT7V4Q,16689
|
|
26
26
|
odoo/addons/account_statement_import_camt/readme/CONTRIBUTORS.rst,sha256=AA9tD-Vwq_KR3eBH08b4wML38hgI-3d2qjeuGIZVCyc,316
|
|
27
27
|
odoo/addons/account_statement_import_camt/readme/CREDITS.rst,sha256=XtPazYj6oqxvg62KjKqErJ8pssTcghFavMtYTDMOozc,87
|
|
28
28
|
odoo/addons/account_statement_import_camt/readme/DESCRIPTION.rst,sha256=JF6P6jSlcI00WiuY_uWzp-VuAzlZsMh3rco3Hw2go7E,73
|
|
29
29
|
odoo/addons/account_statement_import_camt/readme/newsfragment/1_verbose_narration.feature,sha256=cKKbLxMpPc-CNfVB56VXvGdbh9-tR3RXTrKHNRLOBDA,902
|
|
30
30
|
odoo/addons/account_statement_import_camt/static/description/icon.png,sha256=6xBPJauaFOF0KDHfHgQopSc28kKvxMaeoQFQWZtfZDo,9455
|
|
31
|
-
odoo/addons/account_statement_import_camt/static/description/index.html,sha256=
|
|
31
|
+
odoo/addons/account_statement_import_camt/static/description/index.html,sha256=nD3fqyr0gcNs8wdYw4EtSPVEzsvIYBZQl7afB7q1Bjk,13616
|
|
32
32
|
odoo/addons/account_statement_import_camt/test_files/golden-camt053-no-ntry.pydata,sha256=qy8rWuvdmrJDfrLsYTOoBWI5_p7kCJUcH0GB5TLaPQ0,17
|
|
33
|
-
odoo/addons/account_statement_import_camt/test_files/golden-camt053-txdtls.pydata,sha256=
|
|
33
|
+
odoo/addons/account_statement_import_camt/test_files/golden-camt053-txdtls.pydata,sha256=kHTIOdIXcs6vGLT13h9Hih2BIdbzFrwYeTOvvhJvSCA,3317
|
|
34
34
|
odoo/addons/account_statement_import_camt/test_files/golden-camt053.pydata,sha256=Tc4sDXnTINTnW5yg07UsO53fomzto7vUU_cm0EyviQQ,6255
|
|
35
35
|
odoo/addons/account_statement_import_camt/test_files/golden-camt054.pydata,sha256=0PVc5GbnIDa530r-j6Ve0CuTiHY65GS7O6vUaQi4T1o,1681
|
|
36
36
|
odoo/addons/account_statement_import_camt/test_files/test-camt053,sha256=i0lZ1YfucBvgMV7_CCx3hIoxPqRFlv77zDWYWNYUNjA,11415
|
|
@@ -39,9 +39,9 @@ odoo/addons/account_statement_import_camt/test_files/test-camt053-txdtls,sha256=
|
|
|
39
39
|
odoo/addons/account_statement_import_camt/test_files/test-camt053.zip,sha256=7PBdW6gUth4FucG26-555dx46e9aAEzoJLRluCFaq8I,3111
|
|
40
40
|
odoo/addons/account_statement_import_camt/test_files/test-camt054,sha256=KmxxDrLbhICAML57Uf8OtIi_7Oml6cjnqxggQgKR0qg,3833
|
|
41
41
|
odoo/addons/account_statement_import_camt/tests/__init__.py,sha256=fbXubjUerAxsn870MhzwyT_uLaCIt7jWiD91l9FwsRo,41
|
|
42
|
-
odoo/addons/account_statement_import_camt/tests/test_import_bank_statement.py,sha256=
|
|
42
|
+
odoo/addons/account_statement_import_camt/tests/test_import_bank_statement.py,sha256=8HVAvQYdyS0u1L7BmPuZQsENC2UwB6OKVgUWCS6A7LU,7962
|
|
43
43
|
odoo/addons/account_statement_import_camt/views/account_bank_statement_import.xml,sha256=sig4XIO6sOcK4OluJJuSZs8ikWsIrJuOTZEWmDxmEL8,529
|
|
44
|
-
odoo_addon_account_statement_import_camt-16.0.1.0.
|
|
45
|
-
odoo_addon_account_statement_import_camt-16.0.1.0.
|
|
46
|
-
odoo_addon_account_statement_import_camt-16.0.1.0.
|
|
47
|
-
odoo_addon_account_statement_import_camt-16.0.1.0.
|
|
44
|
+
odoo_addon_account_statement_import_camt-16.0.1.0.2.dist-info/METADATA,sha256=aln4MQVeV3KWEuvDsholeYO6Q3r4_oQ0g1FvlTGYhFw,4062
|
|
45
|
+
odoo_addon_account_statement_import_camt-16.0.1.0.2.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
|
46
|
+
odoo_addon_account_statement_import_camt-16.0.1.0.2.dist-info/top_level.txt,sha256=qBj40grFkGOfDZ2WDSw3y1RnDlgG0u8rP8pvGNdbz4w,5
|
|
47
|
+
odoo_addon_account_statement_import_camt-16.0.1.0.2.dist-info/RECORD,,
|