From b4c242648686b8477a084d2a106b4879d15de998 Mon Sep 17 00:00:00 2001 From: Holger Brunn Date: Mon, 22 Apr 2024 14:11:50 +0200 Subject: [PATCH] [MIG] account_statement_import_camt: Migration to 17.0 --- account_statement_import_camt/README.rst | 4 +- account_statement_import_camt/__manifest__.py | 2 +- .../models/__init__.py | 6 +-- .../models/account_bank_statement_line.py | 26 ----------- .../models/account_statement_import.py | 2 +- ...> account_statement_import_camt_parser.py} | 7 ++- .../models/bank_statement.py | 12 ----- .../readme/CONTRIBUTORS.md | 2 +- .../static/description/index.html | 44 +++++++++---------- .../tests/test_import_bank_statement.py | 17 ++++--- 10 files changed, 38 insertions(+), 84 deletions(-) delete mode 100644 account_statement_import_camt/models/account_bank_statement_line.py rename account_statement_import_camt/models/{parser.py => account_statement_import_camt_parser.py} (98%) delete mode 100644 account_statement_import_camt/models/bank_statement.py diff --git a/account_statement_import_camt/README.rst b/account_statement_import_camt/README.rst index 24646f674..cd66c79dc 100644 --- a/account_statement_import_camt/README.rst +++ b/account_statement_import_camt/README.rst @@ -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 @@ -56,7 +56,7 @@ Authors Contributors ------------ -- Holger Brunn +- Holger Brunn - Stefan Rijnhart diff --git a/account_statement_import_camt/__manifest__.py b/account_statement_import_camt/__manifest__.py index 372d07198..cf2187a49 100644 --- a/account_statement_import_camt/__manifest__.py +++ b/account_statement_import_camt/__manifest__.py @@ -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", diff --git a/account_statement_import_camt/models/__init__.py b/account_statement_import_camt/models/__init__.py index 1fe7a2a7f..101063140 100644 --- a/account_statement_import_camt/models/__init__.py +++ b/account_statement_import_camt/models/__init__.py @@ -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 diff --git a/account_statement_import_camt/models/account_bank_statement_line.py b/account_statement_import_camt/models/account_bank_statement_line.py deleted file mode 100644 index 4725b4476..000000000 --- a/account_statement_import_camt/models/account_bank_statement_line.py +++ /dev/null @@ -1,26 +0,0 @@ -# Copyright 2019 Camptocamp SA -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -from odoo import models - - -class AccountBankStatementLine(models.Model): - _inherit = "account.bank.statement.line" - - def write(self, vals): - """ - Purpose of this hook is catch updates for records with name == '/' - - In reconciliation_widget_preprocess, there is attempt to assign - partner into statement line, this assignment relies on name, - during import name setup to '/' for records without it - and this makes search results wrong and partner assignment randomly - """ - if ( - self.env.context.get("no_reassign_empty_name") - and len(self) == 1 - and len(vals.keys()) == 1 - and "partner_id" in vals - and self.name == "/" - ): - return True - return super().write(vals) diff --git a/account_statement_import_camt/models/account_statement_import.py b/account_statement_import_camt/models/account_statement_import.py index bbb40208c..289a71a8f 100644 --- a/account_statement_import_camt/models/account_statement_import.py +++ b/account_statement_import_camt/models/account_statement_import.py @@ -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): diff --git a/account_statement_import_camt/models/parser.py b/account_statement_import_camt/models/account_statement_import_camt_parser.py similarity index 98% rename from account_statement_import_camt/models/parser.py rename to account_statement_import_camt/models/account_statement_import_camt_parser.py index b9b6443d4..73d07003d 100644 --- a/account_statement_import_camt/models/parser.py +++ b/account_statement_import_camt/models/account_statement_import_camt_parser.py @@ -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" @@ -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: diff --git a/account_statement_import_camt/models/bank_statement.py b/account_statement_import_camt/models/bank_statement.py deleted file mode 100644 index 8b1d24c24..000000000 --- a/account_statement_import_camt/models/bank_statement.py +++ /dev/null @@ -1,12 +0,0 @@ -# Copyright 2019 Camptocamp SA -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -from odoo import models - - -class AccountBankStatement(models.Model): - _inherit = "account.bank.statement" - - def reconciliation_widget_preprocess(self): - return super( - AccountBankStatement, self.with_context(no_reassign_empty_name=True) - ).reconciliation_widget_preprocess() diff --git a/account_statement_import_camt/readme/CONTRIBUTORS.md b/account_statement_import_camt/readme/CONTRIBUTORS.md index 3a5493537..18ea84604 100644 --- a/account_statement_import_camt/readme/CONTRIBUTORS.md +++ b/account_statement_import_camt/readme/CONTRIBUTORS.md @@ -1,4 +1,4 @@ -- Holger Brunn \<\> +- Holger Brunn \<\> - Stefan Rijnhart \<\> diff --git a/account_statement_import_camt/static/description/index.html b/account_statement_import_camt/static/description/index.html index b1942b866..8c3f0ea36 100644 --- a/account_statement_import_camt/static/description/index.html +++ b/account_statement_import_camt/static/description/index.html @@ -1,21 +1,19 @@ - - + CAMT Format Bank Statements Import