Skip to content

Commit

Permalink
[MIG] account_statement_import_camt: Migration to 17.0
Browse files Browse the repository at this point in the history
  • Loading branch information
hbrunn committed May 23, 2024
1 parent 02c43b7 commit dba493b
Show file tree
Hide file tree
Showing 10 changed files with 38 additions and 84 deletions.
4 changes: 2 additions & 2 deletions account_statement_import_camt/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ CAMT Format Bank Statements Import
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:6af9753752cdfa39f3d971e084ed946578dc75aafbbc9a600aeb0b8b06b4427b
!! source digest: sha256:a1b71f36ee91c7d89b3cf754ba711cd5d8e50cfb7f9742a9153ca74ce043d458
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
Expand Down Expand Up @@ -56,7 +56,7 @@ Authors
Contributors
------------

- Holger Brunn <[email protected]>
- Holger Brunn <[email protected]>

- Stefan Rijnhart <[email protected]>

Expand Down
2 changes: 1 addition & 1 deletion account_statement_import_camt/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
{
"name": "CAMT Format Bank Statements Import",
"version": "16.0.1.0.1",
"version": "17.0.1.0.0",
"license": "AGPL-3",
"author": "Therp BV, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/bank-statement-import",
Expand Down
6 changes: 2 additions & 4 deletions account_statement_import_camt/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from . import parser
from . import account_bank_statement_line
from . import account_statement_import
from . import account_journal
from . import bank_statement
from . import account_statement_import_camt_parser
from . import account_statement_import

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
_logger = logging.getLogger(__name__)


class AccountBankStatementImport(models.TransientModel):
class AccountStatementImport(models.TransientModel):
_inherit = "account.statement.import"

def _parse_file(self, data_file):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from odoo import _, models


class CamtParser(models.AbstractModel):
class AccountStatementImportCamtParser(models.AbstractModel):
_name = "account.statement.import.camt.parser"
_description = "Account Bank Statement Import CAMT parser"

Expand Down Expand Up @@ -193,9 +193,8 @@ def parse_transaction_details(self, ns, node, transaction):
)
if party_node:
name_node = node.xpath(
"./ns:RltdPties/ns:{pt}/ns:Nm | ./ns:RltdPties/ns:{pt}/ns:Pty/ns:Nm".format(
pt=party_type
),
f"./ns:RltdPties/ns:{party_type}/ns:Nm |"
f"./ns:RltdPties/ns:{party_type}/ns:Pty/ns:Nm",
namespaces={"ns": ns},
)
if name_node:
Expand Down
12 changes: 0 additions & 12 deletions account_statement_import_camt/models/bank_statement.py

This file was deleted.

2 changes: 1 addition & 1 deletion account_statement_import_camt/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
- Holger Brunn \<<[email protected]>\>
- Holger Brunn \<<[email protected]>\>

- Stefan Rijnhart \<<[email protected]>\>

Expand Down
44 changes: 20 additions & 24 deletions account_statement_import_camt/static/description/index.html
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils: https://docutils.sourceforge.io/" />
<meta name="generator" content="Docutils: http://docutils.sourceforge.net/" />
<title>CAMT Format Bank Statements Import</title>
<style type="text/css">

/*
:Author: David Goodger ([email protected])
:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
:Id: $Id: html4css1.css 7952 2016-07-26 18:15:59Z milde $
:Copyright: This stylesheet has been placed in the public domain.

Default cascading style sheet for the HTML output of Docutils.
Despite the name, some widely supported CSS2 features are used.

See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
customize this style sheet.
*/

Expand Down Expand Up @@ -276,7 +274,7 @@
margin-left: 2em ;
margin-right: 2em }

pre.code .ln { color: gray; } /* line numbers */
pre.code .ln { color: grey; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
Expand All @@ -302,7 +300,7 @@
span.pre {
white-space: pre }

span.problematic, pre.problematic {
span.problematic {
color: red }

span.section-subtitle {
Expand Down Expand Up @@ -368,43 +366,43 @@ <h1 class="title">CAMT Format Bank Statements Import</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:6af9753752cdfa39f3d971e084ed946578dc75aafbbc9a600aeb0b8b06b4427b
!! source digest: sha256:a1b71f36ee91c7d89b3cf754ba711cd5d8e50cfb7f9742a9153ca74ce043d458
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<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/17.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-17-0/bank-statement-import-17-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&amp;target_branch=17.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>Module to import SEPA CAMT.053 and CAMT.054 Format bank statement files.</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
<li><a class="reference internal" href="#bug-tracker" id="toc-entry-1">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="toc-entry-2">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="toc-entry-3">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="toc-entry-4">Contributors</a></li>
<li><a class="reference internal" href="#other-credits" id="toc-entry-5">Other credits</a></li>
<li><a class="reference internal" href="#maintainers" id="toc-entry-6">Maintainers</a></li>
<li><a class="reference internal" href="#bug-tracker" id="id1">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="id2">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="id3">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="id4">Contributors</a></li>
<li><a class="reference internal" href="#other-credits" id="id5">Other credits</a></li>
<li><a class="reference internal" href="#maintainers" id="id6">Maintainers</a></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#toc-entry-1">Bug Tracker</a></h1>
<h1><a class="toc-backref" href="#id1">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/bank-statement-import/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/bank-statement-import/issues/new?body=module:%20account_statement_import_camt%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
<h1><a class="toc-backref" href="#toc-entry-2">Credits</a></h1>
<h1><a class="toc-backref" href="#id2">Credits</a></h1>
<div class="section" id="authors">
<h2><a class="toc-backref" href="#toc-entry-3">Authors</a></h2>
<h2><a class="toc-backref" href="#id3">Authors</a></h2>
<ul class="simple">
<li>Therp BV</li>
</ul>
</div>
<div class="section" id="contributors">
<h2><a class="toc-backref" href="#toc-entry-4">Contributors</a></h2>
<h2><a class="toc-backref" href="#id4">Contributors</a></h2>
<ul>
<li><p class="first">Holger Brunn &lt;<a class="reference external" href="mailto:hbrunn&#64;therp.nl">hbrunn&#64;therp.nl</a>&gt;</p>
<li><p class="first">Holger Brunn &lt;<a class="reference external" href="mailto:mail&#64;hunki-enterprises.com">mail&#64;hunki-enterprises.com</a>&gt;</p>
</li>
<li><p class="first">Stefan Rijnhart &lt;<a class="reference external" href="mailto:stefan.rijnhart&#64;opener.amsterdam">stefan.rijnhart&#64;opener.amsterdam</a>&gt;</p>
</li>
Expand All @@ -426,16 +424,14 @@ <h2><a class="toc-backref" href="#toc-entry-4">Contributors</a></h2>
</ul>
</div>
<div class="section" id="other-credits">
<h2><a class="toc-backref" href="#toc-entry-5">Other credits</a></h2>
<h2><a class="toc-backref" href="#id5">Other credits</a></h2>
<p>The migration of this module from 15.0 to 16.0 was financially supported
by Camptocamp</p>
</div>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#toc-entry-6">Maintainers</a></h2>
<h2><a class="toc-backref" href="#id6">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org">
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
</a>
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
from datetime import date
from pathlib import Path

from odoo.modules.module import get_module_resource
from odoo.tests.common import TransactionCase
from odoo.tools.misc import file_path


class TestParserCommon(TransactionCase):
Expand Down Expand Up @@ -45,15 +45,16 @@ def _get_files_diffs(self, inputfile_path, goldenfile_path) -> list:
:param inputfile_path: path for file to import and test
:type inputfile_path: Path
:param goldenfile_path: path for file to use for comparison (the expected values)
:param goldenfile_path: path for file to use for comparison
(the expected values)
:type goldenfile_path: Path
"""

# Read the input file, store the actual imported values
with open(get_module_resource(*inputfile_path.parts), "rb") as inputf:
with open(file_path(inputfile_path), "rb") as inputf:
res = self.parser.parse(inputf.read())
# Read the output file, store the expected imported values
with open(get_module_resource(*goldenfile_path.parts)) as goldf:
with open(file_path(goldenfile_path)) as goldf:
gold_name, gold_lines = goldf.name, goldf.readlines()
# Save the imported values in a tmp file to compare them w/ the expected values
with tempfile.NamedTemporaryFile(mode="w+", suffix=".pydata") as tempf:
Expand Down Expand Up @@ -158,9 +159,7 @@ def setUpClass(cls):

def test_statement_import(self):
"""Test correct creation of single statement."""
testfile = get_module_resource(
"account_statement_import_camt", "test_files", "test-camt053"
)
testfile = file_path("account_statement_import_camt/test_files/test-camt053")
with open(testfile, "rb") as datafile:
camt_file = base64.b64encode(datafile.read())

Expand Down Expand Up @@ -190,8 +189,8 @@ def test_statement_import(self):

def test_zip_import(self):
"""Test import of multiple statements from zip file."""
testfile = get_module_resource(
"account_statement_import_camt", "test_files", "test-camt053.zip"
testfile = file_path(
"account_statement_import_camt/test_files/test-camt053.zip"
)
with open(testfile, "rb") as datafile:
camt_file = base64.b64encode(datafile.read())
Expand Down

0 comments on commit dba493b

Please sign in to comment.