diff --git a/.copier-answers.yml b/.copier-answers.yml index 97e3544..de0edb3 100644 --- a/.copier-answers.yml +++ b/.copier-answers.yml @@ -1,5 +1,5 @@ # Do NOT update manually; changes here will be overwritten by Copier -_commit: v4.3 +_commit: v4.8 _src_path: git@github.com:Noviat-CI/addons-repo-template.git ci_disable_autoinstall_modules: account_asset odoo_test_flavor: Both diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f95ed2c..38b2266 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -46,7 +46,7 @@ jobs: name: test with Odoo Enterprise odoo_enterprise : 1 exclude_modules : "account_asset" - makepot: true + makepot: "true" services: postgres: image: postgres:12.0 @@ -80,7 +80,11 @@ jobs: mkdir -p ${{ env.INSTALL_ADDONS_DIR }}/setup find $(realpath $ADDONS_DIR) $(realpath ${{ env.ADDITIONAL_ADDONS_DIR }}) -name __manifest__.py -exec sh -c 'ln -s "$(dirname "$0")" "${{ env.INSTALL_ADDONS_DIR }}"' {} \; find $(realpath $ADDONS_DIR) $(realpath ${{ env.ADDITIONAL_ADDONS_DIR }}) -iwholename '*/setup/*/setup.py' -exec sh -c 'ln -s "$(dirname "$0")" "${{ env.INSTALL_ADDONS_DIR }}/setup"' {} \; +<<<<<<< before updating if [ -n ${{ matrix.exclude }} ] +======= + if [ -n ${{ matrix.exclude}} ] +>>>>>>> after updating then remove_excluded_modules ${{ env.INSTALL_ADDONS_DIR }} ${{ matrix.exclude }} fi @@ -93,10 +97,10 @@ jobs: run: | echo "ADDONS_PATH=/opt/odoo/addons,${{ env.INSTALL_ADDONS_DIR }}" >> $GITHUB_ENV - name: Add addons to EXCLUDE PATH - if: ${{ env.EXCLUDE_MODULES }} + if: ${{ matrix.EXCLUDE_MODULES }} run: | echo "server_wide_modules = web,module_change_auto_install" >> ${ODOO_RC} - echo "modules_auto_install_disabled = $EXCLUDE_MODULES" >> ${ODOO_RC} + echo "ODOO_MODULES_AUTO_INSTALL_DISABLED=${{ matrix.EXCLUDE_MODULES }}" >> $GITHUB_ENV - name: Install addons and dependencies run: | (ADDONS_PATH=${ADDONS_PATH} ADDONS_DIR=${INSTALL_ADDONS_DIR} oca_install_addons) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8c943c8..1cc78e2 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -38,6 +38,10 @@ repos: entry: found a en.po file language: fail files: '[a-zA-Z0-9_]*/i18n/en\.po$' + - repo: https://github.com/sbidoul/whool + rev: v1.2 + hooks: + - id: whool-init - repo: https://github.com/oca/maintainer-tools rev: bf9ecb9938b6a5deca0ff3d870fbd3f33341fded hooks: @@ -45,6 +49,7 @@ repos: - id: oca-update-pre-commit-excluded-addons - id: oca-fix-manifest-website args: ["https://www.noviat.com/"] + - id: oca-gen-external-dependencies - id: oca-gen-addons-table - repo: https://github.com/OCA/odoo-pre-commit-hooks rev: v0.0.33 diff --git a/README.md b/README.md index e949761..0210d2c 100644 --- a/README.md +++ b/README.md @@ -15,9 +15,10 @@ Available addons ---------------- addon | version | maintainers | summary --- | --- | --- | --- -[account_ebics](account_ebics/) | 18.0.1.0.0 | | EBICS banking protocol +[account_ebics](account_ebics/) | 18.0.1.0.1 | | EBICS banking protocol [account_ebics_batch](account_ebics_batch/) | 18.0.1.0.0 | | EBICS Files automated import and processing [account_ebics_batch_payment](account_ebics_batch_payment/) | 18.0.1.0.0 | | Upload Batch Payment via EBICS +[account_ebics_oca_statement_import](account_ebics_oca_statement_import/) | 18.0.1.0.0 | | Use OCA Bank Statement Import with account_ebics [account_ebics_oe](account_ebics_oe/) | 18.0.1.0.0 | | Deploy account_ebics module on Odoo Enterprise [//]: # (end addons) diff --git a/account_ebics/__manifest__.py b/account_ebics/__manifest__.py index 63745e0..1c35b64 100644 --- a/account_ebics/__manifest__.py +++ b/account_ebics/__manifest__.py @@ -1,9 +1,9 @@ # Copyright 2009-2025 Noviat. -# License LGPL-3 or later (http://www.gnu.org/licenses/lgpl). +# License LGPL-3 or later (https://www.gnu.org/licenses/lgpl). { "name": "EBICS banking protocol", - "version": "18.0.1.0.0", + "version": "18.0.1.0.1", "license": "LGPL-3", "author": "Noviat", "website": "https://www.noviat.com/", diff --git a/account_ebics/data/ebics_file_format.xml b/account_ebics/data/ebics_file_format.xml index 4a83800..8c40ab0 100644 --- a/account_ebics/data/ebics_file_format.xml +++ b/account_ebics/data/ebics_file_format.xml @@ -209,7 +209,6 @@ up BTU SEPA credit transfer - txt SCT pain.001 GLB diff --git a/account_ebics/models/account_bank_statement.py b/account_ebics/models/account_bank_statement.py index 1ae0bbf..34cc44b 100644 --- a/account_ebics/models/account_bank_statement.py +++ b/account_ebics/models/account_bank_statement.py @@ -1,5 +1,5 @@ # Copyright 2009-2024 Noviat. -# License LGPL-3 or later (http://www.gnu.org/licenses/lgpl). +# License LGPL-3 or later (https://www.gnu.org/licenses/lgpl). from odoo import fields, models diff --git a/account_ebics/models/ebics_config.py b/account_ebics/models/ebics_config.py index 5aca89c..26fab66 100644 --- a/account_ebics/models/ebics_config.py +++ b/account_ebics/models/ebics_config.py @@ -1,5 +1,5 @@ # Copyright 2009-2024 Noviat. -# License LGPL-3 or later (http://www.gnu.org/licenses/lgpl). +# License LGPL-3 or later (https://www.gnu.org/licenses/lgpl). import logging import os diff --git a/account_ebics/models/ebics_file.py b/account_ebics/models/ebics_file.py index 1660a16..5f2d893 100644 --- a/account_ebics/models/ebics_file.py +++ b/account_ebics/models/ebics_file.py @@ -1,5 +1,5 @@ # Copyright 2009-2025 Noviat. -# License LGPL-3 or later (http://www.gnu.org/licenses/lgpl). +# License LGPL-3 or later (https://www.gnu.org/licenses/lgpl). import base64 import logging diff --git a/account_ebics/models/ebics_file_format.py b/account_ebics/models/ebics_file_format.py index 5c88f1d..b937ec0 100644 --- a/account_ebics/models/ebics_file_format.py +++ b/account_ebics/models/ebics_file_format.py @@ -1,5 +1,5 @@ # Copyright 2009-2024 Noviat. -# License LGPL-3 or later (http://www.gnu.org/licenses/lgpl). +# License LGPL-3 or later (https://www.gnu.org/licenses/lgpl). from odoo import api, fields, models diff --git a/account_ebics/models/ebics_userid.py b/account_ebics/models/ebics_userid.py index 2172f3a..0ae8a42 100644 --- a/account_ebics/models/ebics_userid.py +++ b/account_ebics/models/ebics_userid.py @@ -1,5 +1,5 @@ # Copyright 2009-2024 Noviat. -# License LGPL-3 or later (http://www.gnu.org/licenses/lgpl). +# License LGPL-3 or later (https://www.gnu.org/licenses/lgpl). import base64 import logging diff --git a/account_ebics/models/fintech_ebics_register.py b/account_ebics/models/fintech_ebics_register.py index dc218f5..5492039 100644 --- a/account_ebics/models/fintech_ebics_register.py +++ b/account_ebics/models/fintech_ebics_register.py @@ -1,5 +1,5 @@ # Copyright 2009-2024 Noviat. -# License LGPL-3 or later (http://www.gnu.org/licenses/lgpl). +# License LGPL-3 or later (https://www.gnu.org/licenses/lgpl). import logging from sys import exc_info diff --git a/account_ebics/views/ebics_file_format_views.xml b/account_ebics/views/ebics_file_format_views.xml index ad4aaa8..99fc173 100644 --- a/account_ebics/views/ebics_file_format_views.xml +++ b/account_ebics/views/ebics_file_format_views.xml @@ -1,5 +1,24 @@ + + ebics.file.format.search + ebics.file.format + + + + + + + + ebics.file.format.list ebics.file.format @@ -49,11 +68,11 @@ required="ebics_version == '3'" invisible="ebics_version == '2'" /> + + - - diff --git a/account_ebics/wizards/ebics_admin_order.py b/account_ebics/wizards/ebics_admin_order.py index c20192b..6e284af 100644 --- a/account_ebics/wizards/ebics_admin_order.py +++ b/account_ebics/wizards/ebics_admin_order.py @@ -1,5 +1,5 @@ # Copyright 2009-2024 Noviat. -# License LGPL-3 or later (http://www.gnu.org/licenses/lgpl). +# License LGPL-3 or later (https://www.gnu.org/licenses/lgpl). import pprint diff --git a/account_ebics/wizards/ebics_change_passphrase.py b/account_ebics/wizards/ebics_change_passphrase.py index 94be2c1..6482e99 100644 --- a/account_ebics/wizards/ebics_change_passphrase.py +++ b/account_ebics/wizards/ebics_change_passphrase.py @@ -1,5 +1,5 @@ # Copyright 2009-2024 Noviat. -# License LGPL-3 or later (http://www.gnu.org/licenses/lgpl). +# License LGPL-3 or later (https://www.gnu.org/licenses/lgpl). import logging diff --git a/account_ebics/wizards/ebics_xfer.py b/account_ebics/wizards/ebics_xfer.py index 562812c..66891e6 100644 --- a/account_ebics/wizards/ebics_xfer.py +++ b/account_ebics/wizards/ebics_xfer.py @@ -1,5 +1,5 @@ # Copyright 2009-2025 Noviat. -# License LGPL-3 or later (http://www.gnu.org/licenses/lgpl). +# License LGPL-3 or later (https://www.gnu.org/licenses/lgpl). import base64 import logging diff --git a/account_ebics_oca_statement_import/README.rst b/account_ebics_oca_statement_import/README.rst new file mode 100644 index 0000000..ad87eca --- /dev/null +++ b/account_ebics_oca_statement_import/README.rst @@ -0,0 +1,17 @@ +.. image:: https://img.shields.io/badge/license-LGPL--3-blue.png + :target: https://www.gnu.org/licenses/lgpl + :alt: License: LGPL-3 + +========================================================== +Deploy account_ebics module with OCA Bank 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_file + diff --git a/account_ebics_oca_statement_import/__init__.py b/account_ebics_oca_statement_import/__init__.py new file mode 100644 index 0000000..5cb1c49 --- /dev/null +++ b/account_ebics_oca_statement_import/__init__.py @@ -0,0 +1 @@ +from . import wizards diff --git a/account_ebics_oca_statement_import/__manifest__.py b/account_ebics_oca_statement_import/__manifest__.py new file mode 100644 index 0000000..9d2dc19 --- /dev/null +++ b/account_ebics_oca_statement_import/__manifest__.py @@ -0,0 +1,19 @@ +# Copyright 2020-2024 Noviat. +# License LGPL-3 or later (https://www.gnu.org/licenses/lgpl). + +{ + "name": "account_ebics with OCA Bank Statement Imoort", + "summary": "Use OCA Bank Statement Import with account_ebics", + "version": "18.0.1.0.0", + "author": "Noviat", + "website": "https://www.noviat.com/", + "category": "Hidden", + "license": "LGPL-3", + "depends": [ + "account_ebics", + "account_statement_import_file", + ], + "installable": True, + "auto_install": True, + "images": ["static/description/cover.png"], +} diff --git a/account_ebics_oca_statement_import/i18n/account_ebics_oca_statement_import.pot b/account_ebics_oca_statement_import/i18n/account_ebics_oca_statement_import.pot new file mode 100644 index 0000000..67f7b94 --- /dev/null +++ b/account_ebics_oca_statement_import/i18n/account_ebics_oca_statement_import.pot @@ -0,0 +1,48 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * account_ebics_oca_statement_import +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 17.0+e\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: account_ebics_oca_statement_import +#. odoo-python +#: code:addons/account_ebics_oca_statement_import/wizards/account_statement_import.py:0 +#, python-format +msgid "Error detected while processing and EBICS File" +msgstr "" + +#. module: account_ebics_oca_statement_import +#: model:ir.model,name:account_ebics_oca_statement_import.model_account_statement_import +msgid "Import Bank Statement Files" +msgstr "" + +#. module: account_ebics_oca_statement_import +#. odoo-python +#: code:addons/account_ebics_oca_statement_import/wizards/account_statement_import.py:0 +#, python-format +msgid "Statement %(st_name)s dated %(date)s has already been imported." +msgstr "" + +#. module: account_ebics_oca_statement_import +#. odoo-python +#: code:addons/account_ebics_oca_statement_import/wizards/account_statement_import.py:0 +#, python-format +msgid "This file doesn't contain any statement." +msgstr "" + +#. module: account_ebics_oca_statement_import +#. odoo-python +#: code:addons/account_ebics_oca_statement_import/wizards/account_statement_import.py:0 +#: code:addons/account_ebics_oca_statement_import/wizards/account_statement_import.py:0 +#, python-format +msgid "This file doesn't contain any transaction." +msgstr "" diff --git a/account_ebics_oca_statement_import/pyproject.toml b/account_ebics_oca_statement_import/pyproject.toml new file mode 100644 index 0000000..4231d0c --- /dev/null +++ b/account_ebics_oca_statement_import/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/account_ebics_oca_statement_import/static/description/cover.png b/account_ebics_oca_statement_import/static/description/cover.png new file mode 100644 index 0000000..41c4cec Binary files /dev/null and b/account_ebics_oca_statement_import/static/description/cover.png differ diff --git a/account_ebics_oca_statement_import/static/description/icon.png b/account_ebics_oca_statement_import/static/description/icon.png new file mode 100644 index 0000000..889d129 Binary files /dev/null and b/account_ebics_oca_statement_import/static/description/icon.png differ diff --git a/account_ebics_oca_statement_import/static/description/index.html b/account_ebics_oca_statement_import/static/description/index.html new file mode 100644 index 0000000..da1134e --- /dev/null +++ b/account_ebics_oca_statement_import/static/description/index.html @@ -0,0 +1,379 @@ + + + + + +README.rst + + + + + + + + +Deploy account_ebics module with OCA Bank 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_file + + + + + diff --git a/account_ebics_oca_statement_import/wizards/__init__.py b/account_ebics_oca_statement_import/wizards/__init__.py new file mode 100644 index 0000000..ae69bca --- /dev/null +++ b/account_ebics_oca_statement_import/wizards/__init__.py @@ -0,0 +1 @@ +from . import account_statement_import diff --git a/account_ebics_oca_statement_import/wizards/account_statement_import.py b/account_ebics_oca_statement_import/wizards/account_statement_import.py new file mode 100644 index 0000000..3326be7 --- /dev/null +++ b/account_ebics_oca_statement_import/wizards/account_statement_import.py @@ -0,0 +1,121 @@ +# Copyright 2009-2024 Noviat. +# License LGPL-3 or later (https://www.gnu.org/licenses/lgpl). + +import logging +from datetime import date, datetime + +from odoo import _, models + +from odoo.addons.base.models.res_bank import sanitize_account_number + +_logger = logging.getLogger(__name__) + + +class AccountStatementImport(models.TransientModel): + _inherit = "account.statement.import" + + def _match_journal(self, account_number, currency): + journal = self.env["account.journal"] + sanitized_account_number = self._sanitize_account_number(account_number) + fin_journals = self.env["account.journal"].search( + [ + ("type", "=", "bank"), + "|", + ("currency_id", "=", currency.id), + ("company_id.currency_id", "=", currency.id), + ] + ) + fin_journal = fin_journals.filtered( + lambda r: sanitized_account_number + in (r.bank_account_id.sanitized_acc_number or "") + ) + if len(fin_journal) == 1: + journal = fin_journal + if not journal: + journal = super()._match_journal(account_number, currency) + return journal + + def _sanitize_account_number(self, account_number): + sanitized_number = sanitize_account_number(account_number) + check_curr = sanitized_number[-3:] + if check_curr.isalpha(): + all_currencies = self.env["res.currency"].search([]) + if check_curr in all_currencies.mapped("name"): + sanitized_number = sanitized_number[:-3] + return sanitized_number + + def _check_parsed_data(self, stmts_vals): + """Basic and structural verifications""" + if self.env.context.get("active_model") == "ebics.file": + message = False + if len(stmts_vals) == 0: + message = _("This file doesn't contain any statement.") + if not message: + no_st_line = True + for vals in stmts_vals: + if vals["transactions"] and len(vals["transactions"]) > 0: + no_st_line = False + break + if no_st_line: + message = _("This file doesn't contain any transaction.") + if message: + log_msg = ( + _("Error detected while processing and EBICS File") + + ":\n" + + message + ) + _logger.warning(log_msg) + return + return super()._check_parsed_data(stmts_vals) + + def _create_bank_statements(self, stmts_vals, result): + """ + Return error message to ebics.file when handling empty camt. + + Remarks/TODO: + We could add more info to the message (e.g. date, balance, ...) + and write this to the ebics.file, note field. + We could also create empty bank statement (in state done) to clearly + show days without transactions via the bank statement list view. + """ + if self.env.context.get("active_model") != "ebics.file": + return super()._create_bank_statements(stmts_vals, result) + else: + messages = [] + transactions = False + for st_vals in stmts_vals: + statement_ids = result["statement_ids"][:] + self._set_statement_name(st_vals) + if st_vals.get("transactions"): + transactions = True + super()._create_bank_statements([st_vals], result) + if result["statement_ids"] == statement_ids: + # no statement has been created, this is the case + # when all transactions have been imported already + if isinstance(st_vals["date"], date) or isinstance( + st_vals["date"], datetime + ): + st_date = st_vals["date"].strftime("%Y-%m-%d") + else: + st_date = st_vals["date"] + messages.append( + _( + "Statement %(st_name)s dated %(date)s " + "has already been imported.", + st_name=st_vals["name"], + date=st_date, + ) + ) + + if not transactions: + messages.append(_("This file doesn't contain any transaction.")) + if messages: + result["notifications"].append( + {"type": "warning", "message": "\n".join(messages)} + ) + return + + def _set_statement_name(self, st_vals): + """ + Inherit this method to set your own statement naming policy. + """
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 :