From 1181b611dfab7dcd8770a3e0c2cf419e6bb236df Mon Sep 17 00:00:00 2001 From: Luc De Meyer Date: Sun, 30 Jul 2023 21:58:51 +0200 Subject: [PATCH] ebics 16.0 : add support for oca camt parser --- .pre-commit-config.yaml | 1 - account_ebics/README.rst | 1 - account_ebics/models/ebics_file.py | 13 ++++++++++++- account_ebics/static/description/index.html | 1 - account_ebics_oca_statement_import/README.rst | 4 ++-- account_ebics_oca_statement_import/__manifest__.py | 6 ++---- .../wizards/account_statement_import.py | 2 +- .../odoo/addons/account_ebics_oca_statement_import | 1 + setup/account_ebics_oca_statement_import/setup.py | 6 ++++++ 9 files changed, 24 insertions(+), 11 deletions(-) create mode 120000 setup/account_ebics_oca_statement_import/odoo/addons/account_ebics_oca_statement_import create mode 100644 setup/account_ebics_oca_statement_import/setup.py diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4904dc9..233cf6e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,7 +1,6 @@ exclude: | (?x) # NOT INSTALLABLE ADDONS - ^account_ebics_oca_statement_import/| ^account_ebics_payment_order/| # END NOT INSTALLABLE ADDONS # Files and folders generated by bots, to avoid loops diff --git a/account_ebics/README.rst b/account_ebics/README.rst index dafe4b1..ec60692 100644 --- a/account_ebics/README.rst +++ b/account_ebics/README.rst @@ -214,6 +214,5 @@ Known Issues / Roadmap ====================== - Add support to import externally generated keys & certificates (currently only 3SKey signature certificate). -- For Odoo 16.0 the interaction with the OCA payment order and bank statement import modules (e.g. french CFONB) is not yet available. - Electronic Distributed Signature (EDS) is not supported in the current version of this module. diff --git a/account_ebics/models/ebics_file.py b/account_ebics/models/ebics_file.py index 8a86417..57b0909 100644 --- a/account_ebics/models/ebics_file.py +++ b/account_ebics/models/ebics_file.py @@ -412,7 +412,18 @@ class EbicsFile(models.Model): return self._process_download_result(res) def _process_camt053_oca(self, res, st_datas): - raise NotImplementedError + for st_data in st_datas: + with self.env.cr.savepoint(): + self._create_statement_camt053_oca(res, st_data) + + def _create_statement_camt053_oca(self, res, st_data): + wiz = ( + self.env["account.statement.import"] + .with_company(st_data["company_id"]) + .with_context(active_model="ebics.file") + .create({"statement_filename": self.name}) + ) + wiz.import_single_file(base64.b64decode(st_data["data"]), res) def _process_camt053_oe(self, res, st_datas): """ diff --git a/account_ebics/static/description/index.html b/account_ebics/static/description/index.html index 9ed5115..b6b1ad1 100644 --- a/account_ebics/static/description/index.html +++ b/account_ebics/static/description/index.html @@ -563,7 +563,6 @@ You can also find this information in the doc folder of this module (file EBICS_

Known Issues / Roadmap

diff --git a/account_ebics_oca_statement_import/README.rst b/account_ebics_oca_statement_import/README.rst index 4fe75a6..ad87eca 100644 --- a/account_ebics_oca_statement_import/README.rst +++ b/account_ebics_oca_statement_import/README.rst @@ -6,12 +6,12 @@ Deploy account_ebics module with OCA Bank Statement Import ========================================================== -This module makes it possible to use OCA account_statement_import +This module makes it possible to use the OCA account_statement_import wizard in combination with 'account_ebics'. This module will be installed automatically when following modules are activated on your odoo database : - account_ebics -- account_statement_import +- account_statement_import_file diff --git a/account_ebics_oca_statement_import/__manifest__.py b/account_ebics_oca_statement_import/__manifest__.py index e882810..ea0ed89 100644 --- a/account_ebics_oca_statement_import/__manifest__.py +++ b/account_ebics_oca_statement_import/__manifest__.py @@ -11,11 +11,9 @@ "license": "LGPL-3", "depends": [ "account_ebics", - "account_statement_import", + "account_statement_import_file", ], - # installable False unit OCA statement import becomes - # available for 16.0 - "installable": False, + "installable": True, "auto_install": True, "images": ["static/description/cover.png"], } diff --git a/account_ebics_oca_statement_import/wizards/account_statement_import.py b/account_ebics_oca_statement_import/wizards/account_statement_import.py index 83f1340..f4eb9e5 100644 --- a/account_ebics_oca_statement_import/wizards/account_statement_import.py +++ b/account_ebics_oca_statement_import/wizards/account_statement_import.py @@ -1,4 +1,4 @@ -# Copyright 2009-2020 Noviat. +# Copyright 2009-2023 Noviat. # License LGPL-3 or later (http://www.gnu.org/licenses/lgpl). import logging diff --git a/setup/account_ebics_oca_statement_import/odoo/addons/account_ebics_oca_statement_import b/setup/account_ebics_oca_statement_import/odoo/addons/account_ebics_oca_statement_import new file mode 120000 index 0000000..766f43e --- /dev/null +++ b/setup/account_ebics_oca_statement_import/odoo/addons/account_ebics_oca_statement_import @@ -0,0 +1 @@ +../../../../account_ebics_oca_statement_import \ No newline at end of file diff --git a/setup/account_ebics_oca_statement_import/setup.py b/setup/account_ebics_oca_statement_import/setup.py new file mode 100644 index 0000000..28c57bb --- /dev/null +++ b/setup/account_ebics_oca_statement_import/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)