From 9fa387def694d88f8f2bdc441101824d0fe7d5f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Didderen?= Date: Tue, 27 Oct 2026 18:02:20 +0100 Subject: [PATCH 01/17] [IMP] addons-repo-template v9.2.1 --- .copier-answers.yml | 3 +- .github/workflows/check-version-bump.yml | 2 +- .github/workflows/pre-commit.yml | 2 +- .github/workflows/test.yml | 66 +++++----- .pre-commit-config.yaml | 14 +-- .pylintrc | 118 ------------------ .pylintrc-mandatory | 3 +- .ruff.toml | 34 +++++ account_ebics/__init__.py | 2 +- .../migrations/13.0.1.1/post-migration.py | 2 +- account_ebics/models/ebics_config.py | 7 +- account_ebics/models/ebics_file.py | 21 ++-- account_ebics/models/ebics_file_format.py | 2 +- account_ebics/models/ebics_userid.py | 18 ++- .../models/fintech_ebics_register.py | 5 +- .../wizards/ebics_change_passphrase.py | 3 +- account_ebics/wizards/ebics_xfer.py | 31 ++--- account_ebics_batch/models/ebics_batch_log.py | 10 +- .../__manifest__.py | 2 +- .../wizards/account_statement_import.py | 67 +++++----- .../models/account_payment_order.py | 67 +++++----- 21 files changed, 188 insertions(+), 291 deletions(-) delete mode 100644 .pylintrc diff --git a/.copier-answers.yml b/.copier-answers.yml index 0dad1bf..395641e 100644 --- a/.copier-answers.yml +++ b/.copier-answers.yml @@ -1,7 +1,8 @@ # Do NOT update manually; changes here will be overwritten by Copier -_commit: v8.0.2 +_commit: v9.1.0 _src_path: git@github.com:Noviat-CI/addons-repo-template.git ci_disable_autoinstall_modules: account_asset +community_excluded_modules: account_ebics_batch_payment,account_ebics_oe odoo_test_flavor: Both odoo_version: 18.0 org_slug: Noviat diff --git a/.github/workflows/check-version-bump.yml b/.github/workflows/check-version-bump.yml index d31d3f5..3fb6ea3 100644 --- a/.github/workflows/check-version-bump.yml +++ b/.github/workflows/check-version-bump.yml @@ -24,6 +24,6 @@ jobs: - name: Add Noviat CI Tools to PATH run: | git clone https://github.com/Noviat-CI/noviat-ci-tools.git /opt/noviat-ci-tools - echo "/opt/noviat-ci-tools" >> $GITHUB_PATH + echo "/opt/noviat-ci-tools" >> "$GITHUB_PATH" - name: Check module version bump run: check_module_version_bump diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index a58efe7..5c2ec71 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -23,7 +23,7 @@ jobs: cache: 'pip' cache-dependency-path: '.pre-commit-config.yaml' - name: Get python version - run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV + run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> "$GITHUB_ENV" - uses: actions/cache@v6 with: path: ~/.cache/pre-commit diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b13a7eb..d2601b1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -20,11 +20,11 @@ jobs: - uses: actions/checkout@v7 - run: | for reqfile in requirements.txt test-requirements.txt ; do - if [ -f ${reqfile} ] ; then + if [ -f "${reqfile}" ] ; then result=0 # reject non-comment lines that contain a / (i.e. URLs, relative paths) # unless they have a "# SKIP TEST" comment - grep "^[^#].*/" ${reqfile} | grep -v "# SKIP TEST" || result=$? + grep "^[^#].*/" "${reqfile}" | grep -v "# SKIP TEST" || result=$? if [ $result -eq 0 ] ; then echo "Unreleased dependencies found in ${reqfile}." exit 1 @@ -33,7 +33,11 @@ jobs: done test: runs-on: ubuntu-latest - container: ${{ matrix.container }} + container: + image: ${{ matrix.container }} + credentials: + username: ${{ github.actor }} + password: ${{ secrets.PRIVATE_TOKEN }} name: ${{ matrix.name }} permissions: pull-requests: write @@ -42,12 +46,12 @@ jobs: fail-fast: false matrix: include: - - container: ghcr.io/oca/oca-ci/py3.10-odoo18.0:latest + - container: ghcr.io/noviat-ci/odoo-ci:18.0-stable name: test with Odoo Community odoo_enterprise : 0 exclude_modules : "account_asset" - exclude: "account_ebics_batch_payment,account_ebics_oe" - - container: ghcr.io/oca/oca-ci/py3.10-odoo18.0:latest + skip: "account_ebics_batch_payment,account_ebics_oe" + - container: ghcr.io/noviat-ci/odoo-ci:18.0-stable name: test with Odoo Enterprise odoo_enterprise : 1 exclude_modules : "account_asset" @@ -73,49 +77,43 @@ jobs: TOKEN: ${{ secrets.PRIVATE_TOKEN }} run: | git config --global http.https://github.com/.extraheader "AUTHORIZATION: basic $(printf 'x-access-token:%s' "$TOKEN" | base64 -w0)" - - name: Set pip constraints (pyOpenSSL / cryptography) + - name: Show the CI image age run: | - cat > /tmp/constraints.txt <<'EOF' - pyOpenSSL == 22.1.0 - cryptography == 38.0.4 - EOF - echo "PIP_CONSTRAINT=/tmp/constraints.txt" >> $GITHUB_ENV - - name: Upgrade pip in container - run: python -m pip install --upgrade pip - - name: Install Odoo upgrade util - run: python -m pip install git+https://github.com/odoo/upgrade-util@master - - name: Add Noviat CI Tools to PATH - run: | - git clone https://github.com/Noviat-CI/noviat-ci-tools.git /opt/noviat-ci-tools - echo "/opt/noviat-ci-tools" >> $GITHUB_PATH - - name: Clone Odoo Enterprise - if: ${{ matrix.odoo_enterprise == 1 }} - run : | - git clone https://github.com/odoo/enterprise.git --depth 1 -b 18.0 /opt/enterprise + age=$(( ( $(date -u +%s) - $(date -u -d "$NOVIAT_CI_IMAGE_BUILD_DATE" +%s) ) / 86400 )) + echo "Image $NOVIAT_CI_ODOO_VERSION built $NOVIAT_CI_IMAGE_BUILD_DATE ($age days old)" | tee -a "$GITHUB_STEP_SUMMARY" - name: Clone Noviat Dependencies run: clone_oca_dependencies_by_noviat - name: Create addons path run: | - 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"' {} \; - if [ -n ${{ matrix.exclude}} ] + mkdir -p "$INSTALL_ADDONS_DIR/setup" + find "$(realpath "$ADDONS_DIR")" "$(realpath "$ADDITIONAL_ADDONS_DIR")" -name __manifest__.py -exec sh -c 'ln -s "$(dirname "$0")" "$1"' {} "$INSTALL_ADDONS_DIR" \; + find "$(realpath "$ADDONS_DIR")" "$(realpath "$ADDITIONAL_ADDONS_DIR")" -iwholename '*/setup/*/setup.py' -exec sh -c 'ln -s "$(dirname "$0")" "$1/setup"' {} "$INSTALL_ADDONS_DIR" \; + # EXCLUDE (from matrix.exclude) only exists with rebel module groups + if [ -n "${EXCLUDE:-}" ] then - remove_excluded_modules ${{ env.INSTALL_ADDONS_DIR }} ${{ matrix.exclude }} + remove_excluded_modules "$INSTALL_ADDONS_DIR" "$EXCLUDE" fi + - name: Skip addons + if: ${{ matrix.skip }} + env: + SKIPPED: ${{ matrix.skip }} + run: | + remove_excluded_modules "$INSTALL_ADDONS_DIR" "$SKIPPED" + echo "EXCLUDE=${EXCLUDE:+$EXCLUDE,}$SKIPPED" >> "$GITHUB_ENV" + echo "Not installed nor tested with Odoo Community: $SKIPPED" | tee -a "$GITHUB_STEP_SUMMARY" - name: Update addons path with enterprise if: ${{ matrix.odoo_enterprise == 1 }} run: | - echo "ADDONS_PATH=/opt/odoo/addons,/opt/enterprise,${{ env.INSTALL_ADDONS_DIR }}" >> $GITHUB_ENV + echo "ADDONS_PATH=/opt/odoo/addons,/opt/enterprise,${{ env.INSTALL_ADDONS_DIR }}" >> "$GITHUB_ENV" - name: Update addons path without enterprise if: ${{ matrix.odoo_enterprise == 0 }} run: | - echo "ADDONS_PATH=/opt/odoo/addons,${{ env.INSTALL_ADDONS_DIR }}" >> $GITHUB_ENV + echo "ADDONS_PATH=/opt/odoo/addons,${{ env.INSTALL_ADDONS_DIR }}" >> "$GITHUB_ENV" - name: Add addons to EXCLUDE PATH if: ${{ matrix.EXCLUDE_MODULES }} run: | - echo "server_wide_modules = web,module_change_auto_install" >> ${ODOO_RC} - echo "ODOO_MODULES_AUTO_INSTALL_DISABLED=${{ matrix.EXCLUDE_MODULES }}" >> $GITHUB_ENV + echo "server_wide_modules = web,module_change_auto_install" >> "${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) @@ -149,7 +147,7 @@ jobs: hide_complexity: true - name: Write to Job Summary if: steps.coverage.outputs.report == 'true' - run: cat code-coverage-results.md >> $GITHUB_STEP_SUMMARY + run: cat code-coverage-results.md >> "$GITHUB_STEP_SUMMARY" - name: Update .pot files run: noviat_export_and_push_pot https://github.com/${{ github.repository }} if: ${{ matrix.makepot == 'true' && github.event_name == 'push' }} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 9cc3fae..c62c1c3 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -6,7 +6,7 @@ exclude: | ^setup/|/static/description/index\.html$| # We don't want to mess with tool-generated files .svg$|/tests/([^/]+/)?cassettes/|^.copier-answers.yml$|^.github/|^eslint.config.cjs|^prettier.config.cjs| - # Maybe reactivate this when all README files include prettier ignore tags? + # README.md holds the generated addons table ^README\.md$| # Library files can have extraneous formatting (even minimized) /static/(src/)?lib/| @@ -121,10 +121,6 @@ repos: - id: check-xml - id: mixed-line-ending args: ["--fix=lf"] - - repo: https://github.com/asottile/pyupgrade - rev: v3.21.2 - hooks: - - id: pyupgrade - repo: https://github.com/astral-sh/ruff-pre-commit rev: v0.16.9 hooks: @@ -137,13 +133,7 @@ repos: rev: v10.0.11 hooks: - id: pylint_odoo - name: pylint (optional, core only) - args: - - --rcfile=.pylintrc - - --exit-zero - verbose: true - - id: pylint_odoo - name: pylint-odoo (mandatory, blocking) + name: pylint-odoo args: - --disable=missing-readme - --rcfile=.pylintrc-mandatory diff --git a/.pylintrc b/.pylintrc deleted file mode 100644 index b3e77fc..0000000 --- a/.pylintrc +++ /dev/null @@ -1,118 +0,0 @@ -[MASTER] -ignore-patterns=["^.*/TODO/.*$"] -load-plugins=pylint_odoo -score=n - -[IMPORTS] -deprecated-modules=pdb,pudb,ipdb,bs4 - -[ODOOLINT] -#readme-template-url="https://github.com/OCA/maintainer-tools/blob/master/template/module/README.rst" -manifest-required-authors=Noviat -manifest-required-keys=license -manifest-deprecated-keys=description,active -license-allowed=AGPL-3,GPL-2,GPL-2 or any later version,GPL-3,GPL-3 or any later version,LGPL-3 -valid-odoo-versions=18.0 - -[MESSAGES CONTROL] -disable=all - -# This .pylintrc contains optional AND mandatory checks and is meant to be -# loaded in an IDE to have it check everything, in the hope this will make -# optional checks more visible to contributors who otherwise never look at a -# green travis to see optional checks that failed. -# .pylintrc-mandatory containing only mandatory checks is used the pre-commit -# config as a blocking check. - -enable = - anomalous-backslash-in-string, - assignment-from-none, - attribute-deprecated, - dangerous-default-value, - deprecated-module, - development-status-allowed, - duplicate-key, - eval-used, - license-allowed, - manifest-author-string, - manifest-deprecated-key, - # manifest-required-author, - manifest-required-key, - manifest-version-format, - method-compute, - method-inverse, - method-required-super, - method-search, - pointless-statement, - pointless-string-statement, - print-used, - redundant-keyword-arg, - reimported, - return-in-init, - sql-injection, - too-few-format-args, - translation-field, - translation-required, - unreachable, - use-vim-comment, - # >= 15 - attribute-string-redundant, - consider-merging-classes-inherited, - context-overridden, - except-pass, - invalid-commit, - manifest-external-assets, - manifest-maintainers-list, - missing-readme, - missing-return, - odoo-addons-relative-import, - odoo-exception-warning, - renamed-field-parameter, - resource-not-exist, - test-folder-imported, - translation-contains-variable, - translation-positional-used, - website-manifest-key-not-valid-uri, - # >= 16 - external-request-timeout, - # >= 19 - bad-builtin-groupby, - category-allowed, - deprecated-name-get, - deprecated-odoo-model-method, - deprecated-self-cr, - inheritable-method-lambda, - inheritable-method-string, - invalid-email, - manifest-behind-migrations, - manifest-data-duplicated, - missing-odoo-file, - no-raise-unlink, - no-search-all, - no-wizard-in-models, - prohibited-method-override, - prefer-env-translation, - translation-format-interpolation, - translation-format-truncated, - translation-injection, - translation-fstring-interpolation, - translation-not-lazy, - translation-too-few-args, - translation-too-many-args, - translation-unsupported-format, - no-write-in-compute, - odoolint, - # >= 20 - manifest-summary-multiline, - # messages that do not cause the lint step to fail - consider-merging-classes-inherited, - invalid-commit, - missing-readme, - odoo-addons-relative-import, - redefined-builtin - - -[REPORTS] -msg-template={path}:{line}: [{msg_id}({symbol}), {obj}] {msg} -output-format=colorized -reports=no diff --git a/.pylintrc-mandatory b/.pylintrc-mandatory index cd769dc..7f68d44 100644 --- a/.pylintrc-mandatory +++ b/.pylintrc-mandatory @@ -11,12 +11,11 @@ deprecated-modules=pdb,pudb,ipdb,bs4 manifest-required-authors=Noviat manifest-required-keys=license manifest-deprecated-keys=description,active -license-allowed=AGPL-3,GPL-2,GPL-2 or any later version,GPL-3,GPL-3 or any later version,LGPL-3 +license-allowed=AGPL-3,LGPL-3,Other proprietary valid-odoo-versions=18.0 [MESSAGES CONTROL] disable=all - enable = anomalous-backslash-in-string, assignment-from-none, diff --git a/.ruff.toml b/.ruff.toml index b153261..1798474 100644 --- a/.ruff.toml +++ b/.ruff.toml @@ -16,6 +16,40 @@ select = [ "E501", # line too long (default 88) "I", # isort "UP", # pyupgrade + # Autofixed + "RET501", + "RET502", + "RET505", + "RET506", + "RET507", + "RET508", + "PLR1711", + "PLR5501", + "RUF019", + "RUF021", + "RUF100", + "SIM114", + "ISC001", + "C4", + "PIE", + "FLY", + "FURB", + # Few and real: logging format, performance, security + "G", + "PERF", + "S102", + "S105", + "S106", + "S107", + "S108", + "S301", + "S603", + "S607", + "S704", + # Commented-out code, blind except, unused unpacked variables + "ERA001", + "BLE001", + "RUF059", ] extend-safe-fixes = ["UP008"] exclude = ["setup/*"] diff --git a/account_ebics/__init__.py b/account_ebics/__init__.py index ecdeb04..2feacf9 100644 --- a/account_ebics/__init__.py +++ b/account_ebics/__init__.py @@ -8,7 +8,7 @@ _logger = logging.getLogger(__name__) try: from . import models from . import wizards -except Exception: +except Exception: # noqa: BLE001 - the module must load without fintech _logger.warning("Import Error, check if fintech lib has been installed") diff --git a/account_ebics/migrations/13.0.1.1/post-migration.py b/account_ebics/migrations/13.0.1.1/post-migration.py index 94783f9..387e175 100644 --- a/account_ebics/migrations/13.0.1.1/post-migration.py +++ b/account_ebics/migrations/13.0.1.1/post-migration.py @@ -25,7 +25,7 @@ def _ebics_config_upgrade(env, version): if os.path.isfile(keys_fn_old): keys_fn = ebics_keys_root + "/" + cfg_data["ebics_user"] + "_keys" os.rename(keys_fn_old, keys_fn) - state = cfg_data["state"] == "active" and "confirm" or "draft" + state = (cfg_data["state"] == "active" and "confirm") or "draft" cfg.write( { "company_ids": [(6, 0, [cfg_data["company_id"]])], diff --git a/account_ebics/models/ebics_config.py b/account_ebics/models/ebics_config.py index b75d1a7..185e6d3 100644 --- a/account_ebics/models/ebics_config.py +++ b/account_ebics/models/ebics_config.py @@ -127,7 +127,7 @@ class EbicsConfig(models.Model): @api.model def _default_ebics_keys(self): - return "/".join(["/etc/odoo/ebics_keys", self._cr.dbname]) + return f"/etc/odoo/ebics_keys/{self._cr.dbname}" @api.constrains("ebics_key_bitlength") def _check_ebics_key_bitlength(self): @@ -185,9 +185,8 @@ class EbicsConfig(models.Model): if c == "Z": o_list[-i] = "0" continue - else: - o_list[-i] = chr(ord(c) + 1) - break + o_list[-i] = chr(ord(c) + 1) + break next_order_number = "".join(o_list) if next_order_number == "ZZZZ": next_order_number = "A000" diff --git a/account_ebics/models/ebics_file.py b/account_ebics/models/ebics_file.py index 33f80ec..9c0c35f 100644 --- a/account_ebics/models/ebics_file.py +++ b/account_ebics/models/ebics_file.py @@ -225,9 +225,8 @@ class EbicsFile(models.Model): journal_currency = jrnl.currency_id or jrnl.company_id.currency_id if journal_currency != currency: continue - else: - journal = jrnl - break + journal = jrnl + break if not journal: message = self.env._( @@ -301,7 +300,7 @@ class EbicsFile(models.Model): self.note_process += self.env._( "%(st_cnt)s bank statement%(sp)s been imported: ", st_cnt=st_cnt, - sp=st_cnt == 1 and self.env._(" has") or self.env._("s have"), + sp=(st_cnt == 1 and self.env._(" has")) or self.env._("s have"), ) self.note_process += "\n" for statement in statements: @@ -392,9 +391,7 @@ class EbicsFile(models.Model): res["notifications"].append({"type": "error", "message": message}) return datas - lines = [] - for i in range(0, len(file_data), 120): - lines.append(file_data[i : i + 120]) + lines = [file_data[i : i + 120] for i in range(0, len(file_data), 120)] st_lines = b"" transactions = False @@ -488,11 +485,12 @@ class EbicsFile(models.Model): try: with self.env.cr.savepoint(): self._create_bank_statement_oca(res, st_data) - except UserError as e: + except UserError as e: # noqa: PERF203 res["notifications"].append( {"type": "error", "message": "".join(e.args)} ) - except Exception: + # Each statement fails alone; the traceback is reported to the user + except Exception: # noqa: BLE001 tb = "".join(format_exception(*exc_info())) res["notifications"].append({"type": "error", "message": tb}) @@ -514,7 +512,7 @@ class EbicsFile(models.Model): try: self._create_bank_statement_oe(res, st_data) self.env.cr.commit() # pylint: disable=E8102 - except UserError as e: + except UserError as e: # noqa: PERF203 msg = "".join(e.args) msg += "\n" msg += self.env._( @@ -522,7 +520,8 @@ class EbicsFile(models.Model): nr=st_data["acc_number"], ) res["notifications"].append({"type": "error", "message": msg}) - except Exception: + # Each statement fails alone; the traceback is reported to the user + except Exception: # noqa: BLE001 tb = "".join(format_exception(*exc_info())) res["notifications"].append({"type": "error", "message": tb}) diff --git a/account_ebics/models/ebics_file_format.py b/account_ebics/models/ebics_file_format.py index b937ec0..3c84744 100644 --- a/account_ebics/models/ebics_file_format.py +++ b/account_ebics/models/ebics_file_format.py @@ -113,7 +113,7 @@ class EbicsFileFormat(models.Model): @api.depends("ebics_version", "name", "btf_message", "description") def _compute_display_name(self): for rec in self: - name = rec.ebics_version == "2" and rec.name or rec.btf_message + name = (rec.ebics_version == "2" and rec.name) or rec.btf_message if rec.description: name += " - " + rec.description rec.display_name = name diff --git a/account_ebics/models/ebics_userid.py b/account_ebics/models/ebics_userid.py index 4aef532..c876466 100644 --- a/account_ebics/models/ebics_userid.py +++ b/account_ebics/models/ebics_userid.py @@ -38,7 +38,7 @@ class EbicsBank(EbicsBank): The OrderID must be a string between 'A000' and 'ZZZZ' and unique for each partner id. """ - return hasattr(self, "_order_number") and self._order_number or "A000" + return (hasattr(self, "_order_number") and self._order_number) or "A000" class EbicsUserID(models.Model): @@ -216,7 +216,9 @@ class EbicsUserID(models.Model): rec.ebics_passphrase_store_readonly = True if rec.state == "draft": rec.ebics_passphrase_required = True - rec.ebics_passphrase_invisible = rec.ebics_keys_found and True or False + rec.ebics_passphrase_invisible = ( + rec.ebics_keys_found and True + ) or False rec.ebics_passphrase_store_readonly = False elif rec.state == "init": rec.ebics_passphrase_required = False @@ -289,9 +291,8 @@ class EbicsUserID(models.Model): keyring["#USER"] except ValueError as err: # noqa: F841 raise UserError(self.env._("Passphrase mismatch.")) # noqa: B904 - else: - if self.state != "draft": - self.ebics_passphrase = False + elif self.state != "draft": + self.ebics_passphrase = False @api.onchange("swift_3skey") def _onchange_swift_3skey(self): @@ -479,7 +480,7 @@ class EbicsUserID(models.Model): lang = lang.lower() lang = lang if lang in INI_LETTER_LANGS else "en" fn_date = fields.Date.today().isoformat() - fn = "_".join([self.ebics_config_id.ebics_host, "ini_letter", fn_date]) + ".pdf" + fn = f"{self.ebics_config_id.ebics_host}_ini_letter_{fn_date}" + ".pdf" letter = user.create_ini_letter(bankname=ebics_config_bank.name, lang=lang) vals = { "ebics_ini_letter": base64.encodebytes(letter), @@ -548,10 +549,7 @@ class EbicsUserID(models.Model): public_bank_keys = public_bank_keys.encode() fn_date = fields.Date.today().isoformat() - fn = ( - "_".join([self.ebics_config_id.ebics_host, "public_bank_keys", fn_date]) - + ".txt" - ) + fn = f"{self.ebics_config_id.ebics_host}_public_bank_keys_{fn_date}" + ".txt" vals = { "ebics_public_bank_keys": base64.encodebytes(public_bank_keys), "ebics_public_bank_keys_fn": fn, diff --git a/account_ebics/models/fintech_ebics_register.py b/account_ebics/models/fintech_ebics_register.py index 7225620..ef220b7 100644 --- a/account_ebics/models/fintech_ebics_register.py +++ b/account_ebics/models/fintech_ebics_register.py @@ -24,8 +24,7 @@ try: fintech_register_users = ( fintech_register_users and [x.strip() for x in fintech_register_users.split(",")] - or None - ) + ) or None fintech.cryptolib = "cryptography" fintech.register( name=fintech_register_name, @@ -38,7 +37,7 @@ except RuntimeError as e: else: _logger.error(str(e)) fintech.register() -except Exception: +except Exception: # noqa: BLE001 - logged with the traceback, then retried msg = "fintech.register error" tb = "".join(format_exception(*exc_info())) msg += f"\n{tb}" diff --git a/account_ebics/wizards/ebics_change_passphrase.py b/account_ebics/wizards/ebics_change_passphrase.py index 628aaa5..7633fc5 100644 --- a/account_ebics/wizards/ebics_change_passphrase.py +++ b/account_ebics/wizards/ebics_change_passphrase.py @@ -70,8 +70,7 @@ class EbicsChangePassphrase(models.TransientModel): passphrase = ( self.ebics_userid_id.ebics_passphrase_store and self.ebics_userid_id.ebics_passphrase - or self.old_pass - ) + ) or self.old_pass try: keyring_params = { "keys": self.ebics_userid_id.ebics_keys_fn, diff --git a/account_ebics/wizards/ebics_xfer.py b/account_ebics/wizards/ebics_xfer.py index 215c476..4ddc1e2 100644 --- a/account_ebics/wizards/ebics_xfer.py +++ b/account_ebics/wizards/ebics_xfer.py @@ -37,7 +37,7 @@ class EbicsBank(EbicsBank): The OrderID must be a string between 'A000' and 'ZZZZ' and unique for each partner id. """ - return hasattr(self, "_order_number") and self._order_number or "A000" + return (hasattr(self, "_order_number") and self._order_number) or "A000" class EbicsXfer(models.TransientModel): @@ -109,8 +109,7 @@ class EbicsXfer(models.TransientModel): ) if cfg and len(cfg) == 1: return cfg - else: - return cfg_mod + return cfg_mod def _compute_ebics_sig_passphrase_invisible(self): for rec in self: @@ -236,8 +235,8 @@ class EbicsXfer(models.TransientModel): ) ) ebics_files = self.env["ebics.file"] - date_from = self.date_from and self.date_from.isoformat() or None - date_to = self.date_to and self.date_to.isoformat() or None + date_from = (self.date_from and self.date_from.isoformat()) or None + date_to = (self.date_to and self.date_to.isoformat()) or None for df in download_formats: success = False try: @@ -314,7 +313,8 @@ class EbicsXfer(models.TransientModel): ) self.note += "\n" self.note += " ".join(e.args) - except Exception: + # Reported to the user in the note + except Exception: # noqa: BLE001 err_cnt += 1 self.note += "\n" self.note += self.env._( @@ -412,7 +412,7 @@ class EbicsXfer(models.TransientModel): suffix = self.format_id.suffix fn = self.upload_fname if suffix and not fn.endswith(suffix): - fn = ".".join([fn, suffix]) + fn = f"{fn}.{suffix}" ef_vals = { "name": self.upload_fname, "data": self.upload_data, @@ -449,7 +449,8 @@ class EbicsXfer(models.TransientModel): self.note += self.env._("EBICS Verification Error:") self.note += "\n" self.note += self.env._("The EBICS response could not be verified.") - except Exception: + # Reported to the user in the note, with the traceback + except Exception: # noqa: BLE001 self.note += "\n" self.note += self.env._("Unknown Error") tb = "".join(format_exception(*exc_info())) @@ -523,7 +524,7 @@ class EbicsXfer(models.TransientModel): # manual_approval replaced by transport_only class param in fintech 7.4 fintech74 = hasattr(EbicsUser, "transport_only") if fintech74: - user_params["transport_only"] = signature_class == "T" and True or False + user_params["transport_only"] = (signature_class == "T" and True) or False try: user = EbicsUser(**user_params) except ValueError as err: @@ -543,7 +544,8 @@ class EbicsXfer(models.TransientModel): try: client = EbicsClient(bank, user, version=self.ebics_config_id.ebics_version) - except Exception: + # Reported to the user in the note, with the traceback + except Exception: # noqa: BLE001 self.note += "\n" self.note += self.env._("Unknown Error") tb = "".join(format_exception(*exc_info())) @@ -608,7 +610,7 @@ class EbicsXfer(models.TransientModel): suffix = file_format.suffix if suffix and not fn.endswith(suffix): - fn = ".".join([fn, suffix]) + fn = f"{fn}.{suffix}" dups = self._check_duplicate_ebics_file(fn, file_format) if dups: raise UserError( @@ -627,7 +629,7 @@ class EbicsXfer(models.TransientModel): "date_from": self.date_from, "date_to": self.date_to, "format_id": file_format.id, - "state": file_format.download_process_method and "draft" or "done", + "state": (file_format.download_process_method and "draft") or "done", "user_id": self._uid, "ebics_userid_id": self.ebics_userid_id.id, "company_ids": self.ebics_config_id.company_ids.ids, @@ -656,9 +658,8 @@ class EbicsXfer(models.TransientModel): break if c == "Z": continue - else: - o_list[-i] = chr(ord(c) + 1) - break + o_list[-i] = chr(ord(c) + 1) + break next_nr = "".join(o_list) if next_nr == "ZZZZ": next_nr = "A000" diff --git a/account_ebics_batch/models/ebics_batch_log.py b/account_ebics_batch/models/ebics_batch_log.py index 8f196fc..61b68db 100644 --- a/account_ebics_batch/models/ebics_batch_log.py +++ b/account_ebics_batch/models/ebics_batch_log.py @@ -120,7 +120,8 @@ class EbicsBatchLog(models.Model): ) except UserError as e: import_dict["errors"].append(err_msg + " ".join(e.args)) - except Exception: + # Each configuration fails alone; reported in the batch log + except Exception: # noqa: BLE001 tb = "".join(format_exception(*exc_info())) import_dict["errors"].append(err_msg + tb) log.file_ids = [(6, 0, ebics_file_ids)] @@ -128,14 +129,15 @@ class EbicsBatchLog(models.Model): log._ebics_process(import_dict) except UserError as e: import_dict["errors"].append(err_msg + " ".join(e.args)) - except Exception: + # Reported in the batch log with the traceback + except Exception: # noqa: BLE001 tb = "".join(format_exception(*exc_info())) import_dict["errors"].append(err_msg + tb) log._finalise_processing(import_dict) def _finalise_processing(self, import_dict): log_item_model = self.env["ebics.batch.log.item"] - state = self.has_draft_files and "draft" or "done" + state = (self.has_draft_files and "draft") or "done" note = "" error_count = 0 if import_dict["errors"]: @@ -157,7 +159,7 @@ class EbicsBatchLog(models.Model): lambda r: r.ebics_passphrase_store ) t_userids = ebics_userids.filtered(lambda r: r.signature_class == "T") - ebics_userid = t_userids and t_userids[0] or ebics_userids[0] + ebics_userid = (t_userids and t_userids[0]) or ebics_userids[0] xfer_wiz = ( self.env["ebics.xfer"] .with_context(ebics_download=True) diff --git a/account_ebics_oca_statement_import/__manifest__.py b/account_ebics_oca_statement_import/__manifest__.py index ac06ec2..f7cd0a1 100644 --- a/account_ebics_oca_statement_import/__manifest__.py +++ b/account_ebics_oca_statement_import/__manifest__.py @@ -4,7 +4,7 @@ { "name": "EBICS - Bank Statement Import (OCA)", "summary": "Process EBICS statement files with the OCA bank statement import", - "version": "18.0.1.0.2", + "version": "18.0.1.0.3", "author": "Noviat", "website": "https://www.noviat.com/", "category": "Hidden", 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 369b296..ac54fc1 100644 --- a/account_ebics_oca_statement_import/wizards/account_statement_import.py +++ b/account_ebics_oca_statement_import/wizards/account_statement_import.py @@ -64,7 +64,7 @@ class AccountStatementImport(models.TransientModel): + message ) _logger.warning(log_msg) - return + return None return super()._check_parsed_data(stmts_vals) def _create_bank_statements(self, stmts_vals, result): @@ -79,42 +79,39 @@ class AccountStatementImport(models.TransientModel): """ 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( - self.env._( - "Statement %(st_name)s dated %(date)s " - "has already been imported.", - st_name=st_vals["name"], - date=st_date, - ) + 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( + self.env._( + "Statement %(st_name)s dated %(date)s " + "has already been imported.", + st_name=st_vals["name"], + date=st_date, ) + ) - if not transactions: - messages.append( - self.env._("This file doesn't contain any transaction.") - ) - if messages: - result["notifications"].append( - {"type": "warning", "message": "\n".join(messages)} - ) - return + if not transactions: + messages.append(self.env._("This file doesn't contain any transaction.")) + if messages: + result["notifications"].append( + {"type": "warning", "message": "\n".join(messages)} + ) + return None def _set_statement_name(self, st_vals): """ diff --git a/account_ebics_payment_order/models/account_payment_order.py b/account_ebics_payment_order/models/account_payment_order.py index cd6b489..7af550d 100644 --- a/account_ebics_payment_order/models/account_payment_order.py +++ b/account_ebics_payment_order/models/account_payment_order.py @@ -59,7 +59,7 @@ class AccountPaymentOrder(models.Model): "\nPlease generate first the Payment Order file." ) ) - elif len(attach) > 1: + if len(attach) > 1: raise UserError( self.env._( "This payment order contains multiple attachments." @@ -68,39 +68,38 @@ class AccountPaymentOrder(models.Model): "EBICS Processing > EBICS Upload menu" ) ) - else: - origin = self.env._("Payment Order") + ": " + self.name - if not self.journal_id.ebics_config_id: - raise UserError( - self.env._( - "No active EBICS configuration available for the selected bank." - ) + origin = self.env._("Payment Order") + ": " + self.name + if not self.journal_id.ebics_config_id: + raise UserError( + self.env._( + "No active EBICS configuration available for the selected bank." ) - ctx.update( - { - "default_ebics_config_id": self.journal_id.ebics_config_id.id, - "default_upload_data": attach.datas, - "default_upload_fname": attach.name, - "origin": origin, - } ) - ebics_xfer = ( - self.env["ebics.xfer"] - .with_company(self.company_id) - .with_context(**ctx) - .create({}) - ) - ebics_xfer._onchange_ebics_config_id() - ebics_xfer._onchange_upload_data() - view = self.env.ref("account_ebics.ebics_xfer_view_form_upload") - act = { - "name": self.env._("EBICS Upload"), - "view_mode": "form", - "res_model": "ebics.xfer", - "view_id": view.id, - "res_id": ebics_xfer.id, - "type": "ir.actions.act_window", - "target": "new", - "context": ctx, + ctx.update( + { + "default_ebics_config_id": self.journal_id.ebics_config_id.id, + "default_upload_data": attach.datas, + "default_upload_fname": attach.name, + "origin": origin, } - return act + ) + ebics_xfer = ( + self.env["ebics.xfer"] + .with_company(self.company_id) + .with_context(**ctx) + .create({}) + ) + ebics_xfer._onchange_ebics_config_id() + ebics_xfer._onchange_upload_data() + view = self.env.ref("account_ebics.ebics_xfer_view_form_upload") + act = { + "name": self.env._("EBICS Upload"), + "view_mode": "form", + "res_model": "ebics.xfer", + "view_id": view.id, + "res_id": ebics_xfer.id, + "type": "ir.actions.act_window", + "target": "new", + "context": ctx, + } + return act From 98ed2588ad3570b05a3b17b9c3a229a4908eea17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Didderen?= Date: Tue, 27 Oct 2026 21:26:36 +0100 Subject: [PATCH 02/17] [FIX] account_ebics - Stop camt split on an invalid XML file The error was noted but processing went on with root.nsmap, raising an AttributeError. Unparseable content now also yields the "Invalid XML file." notification instead of an XMLSyntaxError. --- account_ebics/__manifest__.py | 2 +- account_ebics/models/ebics_file.py | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/account_ebics/__manifest__.py b/account_ebics/__manifest__.py index 6b670b0..8b9f378 100644 --- a/account_ebics/__manifest__.py +++ b/account_ebics/__manifest__.py @@ -7,7 +7,7 @@ "Download bank statements and upload payment files directly from Odoo, " "using the European EBICS standard" ), - "version": "18.0.1.3.0", + "version": "18.0.1.3.1", "license": "LGPL-3", "author": "Noviat", "website": "https://www.noviat.com/", diff --git a/account_ebics/models/ebics_file.py b/account_ebics/models/ebics_file.py index 9c0c35f..f414cb4 100644 --- a/account_ebics/models/ebics_file.py +++ b/account_ebics/models/ebics_file.py @@ -568,10 +568,14 @@ class EbicsFile(models.Model): """ datas = [] file_data = base64.b64decode(self.data) - root = etree.fromstring(file_data, parser=etree.XMLParser(recover=True)) + try: + root = etree.fromstring(file_data, parser=etree.XMLParser(recover=True)) + except etree.XMLSyntaxError: + root = None if root is None: message = self.env._("Invalid XML file.") res["notifications"].append({"type": "error", "message": message}) + return datas ns = {k or "ns": v for k, v in root.nsmap.items()} camt_variant = ns["ns"].split("camt.")[1][:3] variant_tags = { From 967f033caa294bbf5114e3fd9173c88614e09f1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Didderen?= Date: Tue, 27 Oct 2026 21:26:45 +0100 Subject: [PATCH 03/17] [FIX] account_ebics - Report camt statements without account number The xpath result was indexed before the emptiness check, so a statement without IBAN or other account id raised an IndexError instead of the "No bank account number found." notification. --- account_ebics/models/ebics_file.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/account_ebics/models/ebics_file.py b/account_ebics/models/ebics_file.py index f414cb4..05792be 100644 --- a/account_ebics/models/ebics_file.py +++ b/account_ebics/models/ebics_file.py @@ -586,12 +586,11 @@ class EbicsFile(models.Model): camt_tag = variant_tags[camt_variant] stmts = root[0].findall(f"ns:{camt_tag}", ns) for i, stmt in enumerate(stmts): - acc_number = sanitize_account_number( - stmt.xpath( - "ns:Acct/ns:Id/ns:IBAN/text() | ns:Acct/ns:Id/ns:Othr/ns:Id/text()", - namespaces=ns, - )[0] + acc_ids = stmt.xpath( + "ns:Acct/ns:Id/ns:IBAN/text() | ns:Acct/ns:Id/ns:Othr/ns:Id/text()", + namespaces=ns, ) + acc_number = acc_ids and sanitize_account_number(acc_ids[0]) if not acc_number: message = self.env._("No bank account number found.") res["notifications"].append({"type": "error", "message": message}) From 9d3773088f4a881df32047598484295c274bcf65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Didderen?= Date: Tue, 27 Oct 2026 21:26:45 +0100 Subject: [PATCH 04/17] [REM] account_ebics - Remove unused ebics.xfer._update_order_number Every caller uses ebics.config._update_order_number. The wizard copy was dead and wrong: it did not reset Z to 0 when carrying (A0ZZ -> A1ZZ). --- account_ebics/wizards/ebics_xfer.py | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/account_ebics/wizards/ebics_xfer.py b/account_ebics/wizards/ebics_xfer.py index 4ddc1e2..8801730 100644 --- a/account_ebics/wizards/ebics_xfer.py +++ b/account_ebics/wizards/ebics_xfer.py @@ -650,21 +650,6 @@ class EbicsXfer(models.TransientModel): EBICS upload file format. """ - def _update_order_number(self, OrderID): - o_list = list(OrderID) - for i, c in enumerate(reversed(o_list), start=1): - if c == "9": - o_list[-i] = "A" - break - if c == "Z": - continue - o_list[-i] = chr(ord(c) + 1) - break - next_nr = "".join(o_list) - if next_nr == "ZZZZ": - next_nr = "A000" - self.ebics_config_id.order_number = next_nr - def _insert_line_terminator(self, data_in, line_len): data_in = data_in.replace(b"\n", b"").replace(b"\r", b"") data_out = b"" From 8295475b1fa1ba2b296464595d2f0222f21647c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Didderen?= Date: Tue, 27 Oct 2026 21:26:45 +0100 Subject: [PATCH 05/17] [FIX] account_ebics - Do not commit during tests in the Enterprise import _process_bank_statement_oe commits after each statement. Under tests this left the test transaction. Skip the commit when the registry is in test mode or the current thread is a test thread. --- account_ebics/models/ebics_file.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/account_ebics/models/ebics_file.py b/account_ebics/models/ebics_file.py index 05792be..9454e35 100644 --- a/account_ebics/models/ebics_file.py +++ b/account_ebics/models/ebics_file.py @@ -3,6 +3,7 @@ import base64 import logging +import threading from copy import deepcopy from sys import exc_info from traceback import format_exception @@ -507,11 +508,16 @@ class EbicsFile(models.Model): """ We execute a cr.commit() after every statement import since we get a 'savepoint does not exist' error when using 'with self.env.cr.savepoint()'. + The commit is skipped when running tests. """ + testing = self.env.registry.in_test_mode() or getattr( + threading.current_thread(), "testing", False + ) for st_data in st_datas: try: self._create_bank_statement_oe(res, st_data) - self.env.cr.commit() # pylint: disable=E8102 + if not testing: + self.env.cr.commit() # pylint: disable=E8102 except UserError as e: # noqa: PERF203 msg = "".join(e.args) msg += "\n" From 7be63733fd84e2288ebc48c2230e349d41b804f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Didderen?= Date: Tue, 27 Oct 2026 21:26:53 +0100 Subject: [PATCH 06/17] [FIX] account_ebics - Block removal of confirmed EBICS configurations The ondelete guard checked state "active", which ebics.config does not have (draft/confirm), so confirmed configurations could be deleted. Same check as on 19.0. --- account_ebics/models/ebics_config.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/account_ebics/models/ebics_config.py b/account_ebics/models/ebics_config.py index 185e6d3..5711d23 100644 --- a/account_ebics/models/ebics_config.py +++ b/account_ebics/models/ebics_config.py @@ -161,8 +161,8 @@ class EbicsConfig(models.Model): rec.company_ids = rec.journal_ids.mapped("company_id") @api.ondelete(at_uninstall=False) - def _unlink_except_active(self): - if any(rec.state == "active" for rec in self): + def _unlink_except_confirm(self): + if any(rec.state == "confirm" for rec in self): raise UserError( self.env._("You cannot remove active EBICS configurations.") ) From f771a5dab6e69f6e92ebf1e8dade6f557383da2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Didderen?= Date: Tue, 27 Oct 2026 21:26:54 +0100 Subject: [PATCH 07/17] [FIX] account_ebics - Wrap order number ZZZZ to A000 ZZZZ is accepted by the order number constraint, but the next number was computed as 0000, which the constraint then rejects, blocking H003 uploads. Wrap it to A000 like ZZZY already does. --- account_ebics/models/ebics_config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/account_ebics/models/ebics_config.py b/account_ebics/models/ebics_config.py index 5711d23..7705662 100644 --- a/account_ebics/models/ebics_config.py +++ b/account_ebics/models/ebics_config.py @@ -188,7 +188,7 @@ class EbicsConfig(models.Model): o_list[-i] = chr(ord(c) + 1) break next_order_number = "".join(o_list) - if next_order_number == "ZZZZ": + if "ZZZZ" in (OrderID, next_order_number): next_order_number = "A000" self.order_number = next_order_number From 2c03f19026ec06e515608c18de73b13b8acb5f43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Didderen?= Date: Tue, 27 Oct 2026 21:26:54 +0100 Subject: [PATCH 08/17] [FIX] account_ebics - Allow removing pain.002 EBICS files The pain.002 unlink hook raised NotImplementedError, so no EBICS file with that processing method could be deleted. Make it a no-op placeholder like the other formats. --- account_ebics/models/ebics_file.py | 1 - 1 file changed, 1 deletion(-) diff --git a/account_ebics/models/ebics_file.py b/account_ebics/models/ebics_file.py index 9454e35..02b65fa 100644 --- a/account_ebics/models/ebics_file.py +++ b/account_ebics/models/ebics_file.py @@ -652,7 +652,6 @@ class EbicsFile(models.Model): Placeholder for pain.002 specific actions before removing the EBICS data file. """ - raise NotImplementedError def _process_undefined_format(self): raise UserError( From 7abbe675f54af6554dfc715026bf5c3ba9ff757f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Didderen?= Date: Tue, 27 Oct 2026 21:27:01 +0100 Subject: [PATCH 09/17] [FIX] account_ebics - Report errors of EBICS administrative orders The note was not initialised, so a failed client setup raised a TypeError on note += ...; and functional errors were not caught, showing a raw traceback. Initialise the note and report EbicsFunctionalError like EbicsTechnicalError. --- account_ebics/wizards/ebics_admin_order.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/account_ebics/wizards/ebics_admin_order.py b/account_ebics/wizards/ebics_admin_order.py index c465b87..d1a1129 100644 --- a/account_ebics/wizards/ebics_admin_order.py +++ b/account_ebics/wizards/ebics_admin_order.py @@ -9,7 +9,7 @@ from odoo import api, fields, models _logger = logging.getLogger(__name__) try: - from fintech.ebics import EbicsTechnicalError + from fintech.ebics import EbicsFunctionalError, EbicsTechnicalError except ImportError: _logger.warning("Failed to import fintech") @@ -35,6 +35,7 @@ class EbicsAdminOrder(models.TransientModel): def ebics_admin_order(self): self.ensure_one() + self.note = "" client = self._setup_client() if not client: self.note += self.env._( @@ -46,6 +47,14 @@ class EbicsAdminOrder(models.TransientModel): data = getattr(client, self.admin_order_type)(parsed=True) pp = pprint.PrettyPrinter() self.note = pp.pformat(data) + except EbicsFunctionalError as e: + self.note = "\n" + self.note += self.env._( + "EBICS Functional Error during execution of order %(order_type)s:", + order_type=self.admin_order_type, + ) + self.note += "\n" + self.note += f"{e.message} (code: {e.code})" except EbicsTechnicalError as e: self.note = "\n" self.note += self.env._( From f4f40a6fe2935bb7d5ba6a16e4107dd29fc628fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Didderen?= Date: Tue, 27 Oct 2026 21:27:02 +0100 Subject: [PATCH 10/17] [FIX] account_ebics - Explain missing journal in EBICS key initialisation ebics_init_1 read journal_ids[0] before checking it, so a configuration without journal raised an IndexError instead of the "No bank defined" message. --- account_ebics/models/ebics_userid.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/account_ebics/models/ebics_userid.py b/account_ebics/models/ebics_userid.py index c876466..821329a 100644 --- a/account_ebics/models/ebics_userid.py +++ b/account_ebics/models/ebics_userid.py @@ -413,7 +413,7 @@ class EbicsUserID(models.Model): raise UserError(error) from err # Send the public electronic signature key to the bank. - ebics_config_bank = self.ebics_config_id.journal_ids[0].bank_id + ebics_config_bank = self.ebics_config_id.journal_ids[:1].bank_id if not ebics_config_bank: raise UserError( self.env._( @@ -471,7 +471,6 @@ class EbicsUserID(models.Model): self.ebics_config_id._update_order_number(OrderID) # Create an INI-letter which must be printed and sent to the bank. - ebics_config_bank = self.ebics_config_id.journal_ids[0].bank_id cc = ebics_config_bank.country.code if cc in ["FR", "DE"]: lang = cc From 07eb7b4e9b3d7017dd47bfda8d37479ada64e42e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Didderen?= Date: Tue, 27 Oct 2026 22:54:07 +0100 Subject: [PATCH 11/17] [FIX] account_ebics - Report passphrase mismatch when checking keys The keyring was built outside the try block, and fintech raises the passphrase error from the EbicsKeyRing constructor: a wrong passphrase showed a raw ValueError traceback instead of "Passphrase mismatch.". When another keyring instance on the same file is still open in the worker, fintech raises RuntimeError instead, which is now caught too. --- account_ebics/models/ebics_userid.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/account_ebics/models/ebics_userid.py b/account_ebics/models/ebics_userid.py index 821329a..304d013 100644 --- a/account_ebics/models/ebics_userid.py +++ b/account_ebics/models/ebics_userid.py @@ -281,15 +281,17 @@ class EbicsUserID(models.Model): "keys": self.ebics_keys_fn, "passphrase": self.ebics_passphrase, } - keyring = EbicsKeyRing(**keyring_params) try: + keyring = EbicsKeyRing(**keyring_params) # fintech <= 7.4.3 does not have a call to check if a # passphrase matches with the value stored in the keyfile. # We get around this limitation as follows: # Get user keys to check for valid passphrases - # It will raise a ValueError on invalid passphrases - keyring["#USER"] - except ValueError as err: # noqa: F841 + # It will raise a ValueError on invalid passphrases, + # or a RuntimeError when the keyring is already open + # in this process with another passphrase. + keyring["#USER"] # pylint: disable=pointless-statement + except (ValueError, RuntimeError) as err: # noqa: F841 raise UserError(self.env._("Passphrase mismatch.")) # noqa: B904 elif self.state != "draft": self.ebics_passphrase = False From df4bad4bd5c9d2c10e37024e8675e0e7a9f39149 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Didderen?= Date: Tue, 27 Oct 2026 21:27:17 +0100 Subject: [PATCH 12/17] [IMP] account_ebics - Add unit tests Add 97 tests: - account_ebics: order numbers, camt and CFONB split per account, journal lookup, duplicate statements, download and upload wizards, key initialisation (INI/HIA/HPB), passphrase change, admin orders. - account_ebics_batch: scheduled import, import log, reprocess. - account_ebics_payment_order / account_ebics_batch_payment: upload of the payment file and link to the payment document. - account_ebics_statement_import_test (new, test-only, not to install in production): installs the OCA camt and CFONB parsers in CI and runs the end-to-end statement import. The bank is simulated by patching ebics.xfer._setup_client, or the fintech client classes for the key initialisation; keys, certificates and the INI letter are real, created in a temporary directory. --- .copier-answers.yml | 2 +- .github/workflows/test.yml | 2 +- account_ebics/tests/__init__.py | 7 + account_ebics/tests/common.py | 198 ++++++++++++ .../tests/samples/camt053_currency_suffix.xml | 2 + .../tests/samples/camt053_hvb_clav_fx.xml | 2 + .../tests/samples/camt053_multi_account.xml | 2 + .../tests/samples/camt053_no_account.xml | 2 + .../tests/samples/camt053_no_entries.xml | 2 + .../tests/samples/camt053_sparkasse.xml | 2 + .../tests/samples/cfonb120_bad_length.dat | 1 + .../samples/cfonb120_lf_minimal_no_05.dat | 10 + .../samples/cfonb120_lf_multi_account_05.dat | 14 + .../tests/samples/cfonb120_lf_rich_05.dat | 14 + .../samples/cfonb120_no_eol_empty_only.dat | 1 + .../cfonb120_no_eol_multi_account_mixed.dat | 1 + .../cfonb120_no_eol_single_account.dat | 1 + account_ebics/tests/samples/invalid.xml | 1 + account_ebics/tests/samples/ptk_protocol.txt | 3 + .../tests/test_ebics_admin_wizards.py | 152 ++++++++++ account_ebics/tests/test_ebics_config.py | 52 ++++ account_ebics/tests/test_ebics_file.py | 170 +++++++++++ account_ebics/tests/test_ebics_file_split.py | 232 ++++++++++++++ account_ebics/tests/test_ebics_userid.py | 284 ++++++++++++++++++ account_ebics/tests/test_ebics_xfer.py | 245 +++++++++++++++ account_ebics/tests/test_ebics_xfer_client.py | 115 +++++++ account_ebics_batch/__manifest__.py | 2 +- account_ebics_batch/tests/__init__.py | 1 + .../tests/test_ebics_batch_import.py | 95 ++++++ account_ebics_batch_payment/__manifest__.py | 2 +- account_ebics_batch_payment/tests/__init__.py | 1 + .../tests/test_batch_payment_upload.py | 77 +++++ .../README.rst | 15 + .../__init__.py | 0 .../__manifest__.py | 17 ++ .../pyproject.toml | 3 + .../static/description/icon.png | Bin 0 -> 19480 bytes .../tests/__init__.py | 1 + .../tests/test_oe_statement_import.py | 66 ++++ account_ebics_payment_order/__manifest__.py | 2 +- account_ebics_payment_order/tests/__init__.py | 1 + .../tests/test_payment_order_upload.py | 95 ++++++ .../README.rst | 16 + .../__init__.py | 0 .../__manifest__.py | 18 ++ .../pyproject.toml | 3 + .../static/description/icon.png | Bin 0 -> 19480 bytes .../tests/__init__.py | 1 + .../tests/test_statement_import.py | 145 +++++++++ test-requirements.txt | 2 + 50 files changed, 2075 insertions(+), 5 deletions(-) create mode 100644 account_ebics/tests/__init__.py create mode 100644 account_ebics/tests/common.py create mode 100644 account_ebics/tests/samples/camt053_currency_suffix.xml create mode 100644 account_ebics/tests/samples/camt053_hvb_clav_fx.xml create mode 100644 account_ebics/tests/samples/camt053_multi_account.xml create mode 100644 account_ebics/tests/samples/camt053_no_account.xml create mode 100644 account_ebics/tests/samples/camt053_no_entries.xml create mode 100644 account_ebics/tests/samples/camt053_sparkasse.xml create mode 100644 account_ebics/tests/samples/cfonb120_bad_length.dat create mode 100644 account_ebics/tests/samples/cfonb120_lf_minimal_no_05.dat create mode 100644 account_ebics/tests/samples/cfonb120_lf_multi_account_05.dat create mode 100644 account_ebics/tests/samples/cfonb120_lf_rich_05.dat create mode 100644 account_ebics/tests/samples/cfonb120_no_eol_empty_only.dat create mode 100644 account_ebics/tests/samples/cfonb120_no_eol_multi_account_mixed.dat create mode 100644 account_ebics/tests/samples/cfonb120_no_eol_single_account.dat create mode 100644 account_ebics/tests/samples/invalid.xml create mode 100644 account_ebics/tests/samples/ptk_protocol.txt create mode 100644 account_ebics/tests/test_ebics_admin_wizards.py create mode 100644 account_ebics/tests/test_ebics_config.py create mode 100644 account_ebics/tests/test_ebics_file.py create mode 100644 account_ebics/tests/test_ebics_file_split.py create mode 100644 account_ebics/tests/test_ebics_userid.py create mode 100644 account_ebics/tests/test_ebics_xfer.py create mode 100644 account_ebics/tests/test_ebics_xfer_client.py create mode 100644 account_ebics_batch/tests/__init__.py create mode 100644 account_ebics_batch/tests/test_ebics_batch_import.py create mode 100644 account_ebics_batch_payment/tests/__init__.py create mode 100644 account_ebics_batch_payment/tests/test_batch_payment_upload.py create mode 100644 account_ebics_oe_statement_import_test/README.rst create mode 100644 account_ebics_oe_statement_import_test/__init__.py create mode 100644 account_ebics_oe_statement_import_test/__manifest__.py create mode 100644 account_ebics_oe_statement_import_test/pyproject.toml create mode 100644 account_ebics_oe_statement_import_test/static/description/icon.png create mode 100644 account_ebics_oe_statement_import_test/tests/__init__.py create mode 100644 account_ebics_oe_statement_import_test/tests/test_oe_statement_import.py create mode 100644 account_ebics_payment_order/tests/__init__.py create mode 100644 account_ebics_payment_order/tests/test_payment_order_upload.py create mode 100644 account_ebics_statement_import_test/README.rst create mode 100644 account_ebics_statement_import_test/__init__.py create mode 100644 account_ebics_statement_import_test/__manifest__.py create mode 100644 account_ebics_statement_import_test/pyproject.toml create mode 100644 account_ebics_statement_import_test/static/description/icon.png create mode 100644 account_ebics_statement_import_test/tests/__init__.py create mode 100644 account_ebics_statement_import_test/tests/test_statement_import.py diff --git a/.copier-answers.yml b/.copier-answers.yml index 395641e..b09966a 100644 --- a/.copier-answers.yml +++ b/.copier-answers.yml @@ -2,7 +2,7 @@ _commit: v9.1.0 _src_path: git@github.com:Noviat-CI/addons-repo-template.git ci_disable_autoinstall_modules: account_asset -community_excluded_modules: account_ebics_batch_payment,account_ebics_oe +community_excluded_modules: account_ebics_batch_payment,account_ebics_oe,account_ebics_oe_statement_import_test odoo_test_flavor: Both odoo_version: 18.0 org_slug: Noviat diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d2601b1..bc61fa9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -50,7 +50,7 @@ jobs: name: test with Odoo Community odoo_enterprise : 0 exclude_modules : "account_asset" - skip: "account_ebics_batch_payment,account_ebics_oe" + skip: "account_ebics_batch_payment,account_ebics_oe,account_ebics_oe_statement_import_test" - container: ghcr.io/noviat-ci/odoo-ci:18.0-stable name: test with Odoo Enterprise odoo_enterprise : 1 diff --git a/account_ebics/tests/__init__.py b/account_ebics/tests/__init__.py new file mode 100644 index 0000000..276c594 --- /dev/null +++ b/account_ebics/tests/__init__.py @@ -0,0 +1,7 @@ +from . import test_ebics_admin_wizards +from . import test_ebics_config +from . import test_ebics_file +from . import test_ebics_file_split +from . import test_ebics_userid +from . import test_ebics_xfer +from . import test_ebics_xfer_client diff --git a/account_ebics/tests/common.py b/account_ebics/tests/common.py new file mode 100644 index 0000000..b9b57f4 --- /dev/null +++ b/account_ebics/tests/common.py @@ -0,0 +1,198 @@ +# Copyright 2026 Noviat. +# License LGPL-3 or later (https://www.gnu.org/licenses/lgpl). + +import base64 +from contextlib import contextmanager +from unittest.mock import patch + +from odoo import Command, fields +from odoo.tools import file_open + +from odoo.addons.account.tests.common import AccountTestInvoicingCommon + +# Synthetic files: structures mirror real bank files, all values are invented. +SAMPLES_DIR = "account_ebics/tests/samples" + +# Bank accounts used in the samples (fictitious, checksum-valid). +IBAN_CMB = "FR7615589297011000000010111" +IBAN_CA833 = [ + "FR7613306000012000000020197", + "FR7613306000012000000020294", + "FR7613306000012000000020391", +] +IBAN_LCL = [ + "FR7630002004563000000030102", + "FR7630002004563000000030296", + "FR7630002004563000000030393", + "FR7630002004563000000030490", +] +IBAN_CA879 = [ + "FR7617906000324000000040136", + "FR7617906000324000000040233", + "FR7617906000324000000040330", + "FR7617906000324000000040427", +] +IBAN_CIC = "FR7630087331005000000050175" +IBAN_HVB = "DE54793200750010000001" +IBAN_SPK = "DE52305500000010000002" +IBAN_MULTI = ["DE69370400440010000003", "DE42370400440010000004"] +IBAN_SUFFIX = "DE15370400440010000005" + + +def read_sample(name): + with file_open(f"{SAMPLES_DIR}/{name}", "rb") as f: + return f.read() + + +class FakeEbicsClient: + """Stand-in for fintech.ebics.EbicsClient, returned by a patched + ebics.xfer._setup_client so that no keyring and no bank are needed. + + :param downloads: dict order type ("BTD", "FDL" or the EBICS 2 order + type) -> bytes (or dict of document name -> bytes) to return. + :param error: exception instance raised by every transfer call. + """ + + def __init__(self, downloads=None, order_id="N001", error=None): + self.downloads = downloads or {} + self.order_id = order_id + self.error = error + self.uploads = [] + self.confirmed = [] + self.last_trans_id = "TRANS0001" + + def _download(self, key): + if self.error: + raise self.error + return self.downloads[key] + + def _upload(self, key, data, kwargs): + if self.error: + raise self.error + self.uploads.append((key, data, kwargs)) + return self.order_id + + def BTD(self, btf, start=None, end=None, **kwargs): + return self._download("BTD") + + def FDL(self, filetype, start=None, end=None): + return self._download("FDL") + + def download(self, order_type, params=None): + return self._download(order_type) + + def BTU(self, btf, data, **kwargs): + return self._upload("BTU", data, kwargs) + + def FUL(self, filetype, data, **kwargs): + return self._upload("FUL", data, kwargs) + + def upload(self, order_type, data): + return self._upload(order_type, data, {}) + + def confirm_download(self, trans_id=None, success=True): + self.confirmed.append((trans_id, success)) + + +class EbicsTestCommon(AccountTestInvoicingCommon): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.env.user.groups_id |= cls.env.ref("account_ebics.group_ebics_manager") + cls.eur = cls.env.ref("base.EUR") + cls.eur.active = True + cls.company = cls.env.company + cls.ebics_config = cls.env["ebics.config"].create( + { + "name": "Test Bank", + "ebics_host": "TESTHOST", + "ebics_url": "https://ebics.example.invalid/ebics", + "ebics_partner": "PARTNER1", + "ebics_version": "H004", + "state": "confirm", + } + ) + cls.ebics_userid = cls.env["ebics.userid"].create( + { + "name": "USER1", + "ebics_config_id": cls.ebics_config.id, + "user_ids": [Command.set(cls.env.user.ids)], + "company_ids": [Command.set(cls.company.ids)], + "ebics_passphrase": "test-passphrase", + "ebics_passphrase_store": True, + "state": "active_keys", + } + ) + cls.ff_camt053 = cls.env.ref("account_ebics.ebics_ff_C53") + cls.ff_cfonb120 = cls.env.ref( + "account_ebics.ebics_ff_FDL_camt_xxx_cfonb120_stm" + ) + cls.ff_btd_cfonb120 = cls.env.ref("account_ebics.ebics_ff_btf_cfonb120") + + @classmethod + def _create_bank_journal(cls, code, acc_number, currency=None): + # sudo: accountants may not create bank accounts (res.partner.bank) + journal = ( + cls.env["account.journal"] + .sudo() + .create( + { + "name": f"Bank {code}", + "code": code, + "type": "bank", + "bank_acc_number": acc_number, + "currency_id": (currency or cls.eur).id, + "company_id": cls.company.id, + } + ) + .sudo(False) + ) + cls.ebics_config.journal_ids = [Command.link(journal.id)] + return journal + + @classmethod + def _create_ebics_file(cls, sample, file_format, name=None): + return cls.env["ebics.file"].create( + { + "name": name or sample, + "data": base64.b64encode(read_sample(sample)), + "date": fields.Datetime.now(), + "format_id": file_format.id, + } + ) + + @staticmethod + def _new_res(): + return {"statement_ids": [], "notifications": []} + + @contextmanager + def _fake_client(self, client): + xfer_class = type(self.env["ebics.xfer"]) + with patch.object(xfer_class, "_setup_client", return_value=client): + yield client + + def _download_wizard(self, file_format, **vals): + return ( + self.env["ebics.xfer"] + .with_context(ebics_download=True) + .create( + { + "ebics_config_id": self.ebics_config.id, + "ebics_userid_id": self.ebics_userid.id, + "format_id": file_format.id, + **vals, + } + ) + ) + + def _upload_wizard(self, file_format, data=b"", fname="pay.xml", **vals): + return self.env["ebics.xfer"].create( + { + "ebics_config_id": self.ebics_config.id, + "ebics_userid_id": self.ebics_userid.id, + "format_id": file_format.id, + "upload_data": base64.b64encode(data), + "upload_fname": fname, + **vals, + } + ) diff --git a/account_ebics/tests/samples/camt053_currency_suffix.xml b/account_ebics/tests/samples/camt053_currency_suffix.xml new file mode 100644 index 0000000..a0e74c3 --- /dev/null +++ b/account_ebics/tests/samples/camt053_currency_suffix.xml @@ -0,0 +1,2 @@ + +MSG-TEST-00012026-10-13T22:00:00SUFFIX-STMT-112026-10-13T22:00:000010000005EUREUROPBD10.00CRDT
2026-10-13
CLBD15.00CRDT
2026-10-13
SUFFIX-00015.00CRDTBOOK
2026-10-13
2026-10-13
SUFFIX-0001PMNTICDTESCTNTRF+116DKSUFFIX-00015.00Rho refund
diff --git a/account_ebics/tests/samples/camt053_hvb_clav_fx.xml b/account_ebics/tests/samples/camt053_hvb_clav_fx.xml new file mode 100644 index 0000000..643e6db --- /dev/null +++ b/account_ebics/tests/samples/camt053_hvb_clav_fx.xml @@ -0,0 +1,2 @@ + +MSG-TEST-00012026-10-13T22:00:00HVB-STMT-000112026-10-13T22:00:00DE54793200750010000001EUROPBD5000.00CRDT
2026-10-13
CLBD3992.50CRDT
2026-10-13
CLAV3992.50CRDT
2026-10-13
HVB-0001150.00DBITBOOK
2026-10-13
2026-10-13
HVB-0001PMNTICDTESCTNTRF+116DKHVB-0001E2E-LAMBDA-118150.00Rechnung 2026-118 Lambda GmbH
HVB-0002857.50DBITBOOK
2026-10-13
2026-10-13
HVB-0002PMNTICDTESCTNTRF+116DKHVB-0002857.501000.0012.50Zahlung USD Mu Inc
diff --git a/account_ebics/tests/samples/camt053_multi_account.xml b/account_ebics/tests/samples/camt053_multi_account.xml new file mode 100644 index 0000000..d151433 --- /dev/null +++ b/account_ebics/tests/samples/camt053_multi_account.xml @@ -0,0 +1,2 @@ + +MSG-TEST-00012026-10-13T22:00:00MULTI-STMT-112026-10-13T22:00:00DE69370400440010000003EUROPBD100.00CRDT
2026-10-13
CLBD130.00CRDT
2026-10-13
MULTI-000130.00CRDTBOOK
2026-10-13
2026-10-13
MULTI-0001PMNTICDTESCTNTRF+116DKMULTI-000130.00Omikron payment
MULTI-STMT-212026-10-13T22:00:00DE42370400440010000004EUROPBD200.00CRDT
2026-10-13
CLBD180.00CRDT
2026-10-13
MULTI-000220.00DBITBOOK
2026-10-13
2026-10-13
MULTI-0002PMNTICDTESCTNTRF+116DKMULTI-000220.00Pi fee
diff --git a/account_ebics/tests/samples/camt053_no_account.xml b/account_ebics/tests/samples/camt053_no_account.xml new file mode 100644 index 0000000..d828f0d --- /dev/null +++ b/account_ebics/tests/samples/camt053_no_account.xml @@ -0,0 +1,2 @@ + +MSG-TEST-00012026-10-13T22:00:00NOACC-STMT-112026-10-13T22:00:00EUROPBD1.00CRDT
2026-10-13
CLBD2.00CRDT
2026-10-13
NOACC-00011.00CRDTBOOK
2026-10-13
2026-10-13
NOACC-0001PMNTICDTESCTNTRF+116DKNOACC-00011.00Sigma
diff --git a/account_ebics/tests/samples/camt053_no_entries.xml b/account_ebics/tests/samples/camt053_no_entries.xml new file mode 100644 index 0000000..14976f3 --- /dev/null +++ b/account_ebics/tests/samples/camt053_no_entries.xml @@ -0,0 +1,2 @@ + +MSG-TEST-00012026-10-13T22:00:00EMPTY-STMT-112026-10-13T22:00:00DE52305500000010000002EUROPBD720.00CRDT
2026-10-13
CLBD720.00CRDT
2026-10-13
diff --git a/account_ebics/tests/samples/camt053_sparkasse.xml b/account_ebics/tests/samples/camt053_sparkasse.xml new file mode 100644 index 0000000..b7bc978 --- /dev/null +++ b/account_ebics/tests/samples/camt053_sparkasse.xml @@ -0,0 +1,2 @@ + +MSG-TEST-00012026-10-13T22:00:00SPK-STMT-000112026-10-13T22:00:00DE52305500000010000002EUROPBD720.00CRDT
2026-10-13
CLBD1065.00CRDT
2026-10-13
SPK-0001400.00CRDTBOOK
2026-10-13
2026-10-13
SPK-0001PMNTICDTESCTNTRF+116DKSPK-0001400.00Gutschrift Nu KG
SPK-000255.00DBITBOOK
2026-10-13
2026-10-13
SPK-0002PMNTICDTESCTNTRF+116DKSPK-000255.00Lastschrift Xi Versicherung
diff --git a/account_ebics/tests/samples/cfonb120_bad_length.dat b/account_ebics/tests/samples/cfonb120_bad_length.dat new file mode 100644 index 0000000..2cbc1f5 --- /dev/null +++ b/account_ebics/tests/samples/cfonb120_bad_length.dat @@ -0,0 +1 @@ +0115589 29701EUR2 10000000101 131026 0000000015000{ \ No newline at end of file diff --git a/account_ebics/tests/samples/cfonb120_lf_minimal_no_05.dat b/account_ebics/tests/samples/cfonb120_lf_minimal_no_05.dat new file mode 100644 index 0000000..0068ab6 --- /dev/null +++ b/account_ebics/tests/samples/cfonb120_lf_minimal_no_05.dat @@ -0,0 +1,10 @@ +0117906 00032EUR2 40000000401 131026** COMPTE COURANT 0000000000100{ +0717906 00032EUR2 40000000401 131026--------------------------------------------------0000000000100{ +0117906 00032EUR2 40000000402 131026** COMPTE EPARGNE 0000000000200{ +0717906 00032EUR2 40000000402 131026--------------------------------------------------0000000000200{ +0117906 00032EUR2 40000000403 131026 0000000000300{ +0717906 00032EUR2 40000000403 131026 0000000000300{ +0117906 00032EUR2 40000000404 131026 0000000040000{ +0417906000000032EUR2 4000000040405131026 131026VIR ETA SA 0000000 0000000015000{ +0417906000000032EUR2 4000000040405131026 131026PRLV THETA ASSURANCES 0000000 0000000002100} +0717906 00032EUR2 40000000404 131026 0000000052900{ diff --git a/account_ebics/tests/samples/cfonb120_lf_multi_account_05.dat b/account_ebics/tests/samples/cfonb120_lf_multi_account_05.dat new file mode 100644 index 0000000..be1e5c9 --- /dev/null +++ b/account_ebics/tests/samples/cfonb120_lf_multi_account_05.dat @@ -0,0 +1,14 @@ +0113306 00001EUR2 20000000201 131026 0000000084000{ +0413306000000001EUR2 2000000020105131026 131026VIR SEPA RECU GAMMA SARL 0000000 0000000006400{ +0513306000000001EUR2 2000000020105131026 NBEGAMMA SARL +0513306000000001EUR2 2000000020105131026 LCCFACT 99812 +0513306000000001EUR2 2000000020105131026 REFE2E-GAMMA-1 +0413306000000001EUR2 2000000020105131026 131026PRLV SEPA DELTA ENERGIE 0000000 0000000001325N +0513306000000001EUR2 2000000020105131026 NPYDELTA ENERGIE +0513306000000001EUR2 2000000020105131026 RUMRUM-DELTA-0042 +0713306 00001EUR2 20000000201 131026 0000000089074E +0113306 00001EUR2 20000000202 131026 0000000012345{ +0713306 00001EUR2 20000000202 131026 0000000012345{ +0113306 00001EUR2 20000000203 131026 0000000000500{ +0413306000000001EUR2 2000000020305131026 131026FRAIS TENUE DE COMPTE 0000000 0000000000099} +0713306 00001EUR2 20000000203 131026 0000000000401{ diff --git a/account_ebics/tests/samples/cfonb120_lf_rich_05.dat b/account_ebics/tests/samples/cfonb120_lf_rich_05.dat new file mode 100644 index 0000000..211b0f2 --- /dev/null +++ b/account_ebics/tests/samples/cfonb120_lf_rich_05.dat @@ -0,0 +1,14 @@ +0130087 33100EUR2 50000000501 131026 0000000009900{ +0430087000033100EUR2 5000000050105131026 131026VIR SEPA IOTA DISTRIBUTION 0000000 0000000021500{ +0530087000033100EUR2 5000000050105131026 NOMIOTA DISTRIBUTION +0530087000033100EUR2 5000000050105131026 RIB30087331005000000050199 +0530087000033100EUR2 5000000050105131026 IBEFR7630087331005000000050199 +0530087000033100EUR2 5000000050105131026 CBECMCIFRPP +0530087000033100EUR2 5000000050105131026 LCCFACTURE 7731 +0530087000033100EUR2 5000000050105131026 RCNSALE +0530087000033100EUR2 5000000050105131026 REFE2E-IOTA-7731 +0430087000033100EUR2 5000000050105131026 131026PRLV SEPA KAPPA TELECOM 0000000 0000000000499R +0530087000033100EUR2 5000000050105131026 NPYKAPPA TELECOM +0530087000033100EUR2 5000000050105131026 RUMRUM-KAPPA-1 +0530087000033100EUR2 5000000050105131026 LIBABONNEMENT +0730087 33100EUR2 50000000501 131026 0000000030900A diff --git a/account_ebics/tests/samples/cfonb120_no_eol_empty_only.dat b/account_ebics/tests/samples/cfonb120_no_eol_empty_only.dat new file mode 100644 index 0000000..3c65d82 --- /dev/null +++ b/account_ebics/tests/samples/cfonb120_no_eol_empty_only.dat @@ -0,0 +1 @@ +0115589 29701EUR2 10000000101 131026 0000000015000{ 0715589 29701EUR2 10000000101 131026 0000000015000{ \ No newline at end of file diff --git a/account_ebics/tests/samples/cfonb120_no_eol_multi_account_mixed.dat b/account_ebics/tests/samples/cfonb120_no_eol_multi_account_mixed.dat new file mode 100644 index 0000000..0ee83fd --- /dev/null +++ b/account_ebics/tests/samples/cfonb120_no_eol_multi_account_mixed.dat @@ -0,0 +1 @@ +0130002 00456EUR2 30000000301 131026 0000000001000{ 0730002 00456EUR2 30000000301 131026 0000000001000{ 0130002 00456EUR2 30000000302 131026 0000000025000{ 0430002000000456EUR2 3000000030205131026 131026VIR SEPA EPSILON SAS 0000000 0000000007800{ 0530002000000456EUR2 3000000030205131026 LIBACOMPTE CHANTIER 12 0430002000000456EUR2 3000000030205131026 131026CB STATION ZETA 0000000 0000000000612} 0730002 00456EUR2 30000000302 131026 0000000032188{ 0130002 00456EUR2 30000000303 131026 0000000000000{ 0730002 00456EUR2 30000000303 131026 0000000000000{ 0130002 00456EUR2 30000000304 131026 0000000003200{ 0430002000000456EUR2 3000000030405131026 131026REMISE CHEQUES 0000000 0000000004500{ 0730002 00456EUR2 30000000304 131026 0000000007700{ \ No newline at end of file diff --git a/account_ebics/tests/samples/cfonb120_no_eol_single_account.dat b/account_ebics/tests/samples/cfonb120_no_eol_single_account.dat new file mode 100644 index 0000000..3654423 --- /dev/null +++ b/account_ebics/tests/samples/cfonb120_no_eol_single_account.dat @@ -0,0 +1 @@ +0115589 29701EUR2 10000000101 131026 0000000015000{ 0415589000029701EUR2 1000000010105131026 131026PRLV SEPA FOURNISSEUR ALPHA 0000000 0000000002504} 0515589000029701EUR2 1000000010105131026 LIBFACTURE 2026-0412 0515589000029701EUR2 1000000010105131026 RCNREF ALPHA 77881 0415589000029701EUR2 1000000010105131026 131026VIR SEPA CLIENT BETA 0000000 0000000012000{ 0515589000029701EUR2 1000000010105131026 LCCCOMMANDE 5521 0715589 29701EUR2 10000000101 131026 0000000024496{ \ No newline at end of file diff --git a/account_ebics/tests/samples/invalid.xml b/account_ebics/tests/samples/invalid.xml new file mode 100644 index 0000000..e7d8eec --- /dev/null +++ b/account_ebics/tests/samples/invalid.xml @@ -0,0 +1 @@ +this is not an xml document diff --git a/account_ebics/tests/samples/ptk_protocol.txt b/account_ebics/tests/samples/ptk_protocol.txt new file mode 100644 index 0000000..70c9e41 --- /dev/null +++ b/account_ebics/tests/samples/ptk_protocol.txt @@ -0,0 +1,3 @@ +Kundenprotokoll (PTK) +Auftragsart: C53 Auftragsnummer: A00T Teilnehmer: TESTUSER1 +Status: Auftrag erfolgreich verarbeitet diff --git a/account_ebics/tests/test_ebics_admin_wizards.py b/account_ebics/tests/test_ebics_admin_wizards.py new file mode 100644 index 0000000..0d671da --- /dev/null +++ b/account_ebics/tests/test_ebics_admin_wizards.py @@ -0,0 +1,152 @@ +# Copyright 2026 Noviat. +# License LGPL-3 or later (https://www.gnu.org/licenses/lgpl). + +import pprint +from unittest.mock import patch + +from fintech.ebics import EbicsFunctionalError, EbicsKeyRing, EbicsTechnicalError + +from odoo.exceptions import UserError +from odoo.tests import tagged + +from .test_ebics_userid import EbicsKeysCommon + +# Test passphrases for throwaway keys created in a temporary directory. +INIT_PHRASE = "init-passphrase" +NEXT_PHRASE = "next-passphrase" +OTHER_PHRASE = "other-passphrase" +WRONG_PHRASE = "wrong-passphrase" + + +@tagged("post_install", "-at_install") +class TestChangePassphrase(EbicsKeysCommon): + def setUp(self): + super().setUp() + self.userid = self._new_userid() + self._init_1(self.userid) + + def _change(self, **vals): + wizard = self.env["ebics.change.passphrase"].create( + {"ebics_userid_id": self.userid.id, **vals} + ) + wizard.change_passphrase() + return wizard + + def test_change_passphrase(self): + wizard = self._change( + old_pass=INIT_PHRASE, + new_pass=NEXT_PHRASE, + new_pass_check=NEXT_PHRASE, + ) + self.assertEqual(self.userid.ebics_passphrase, NEXT_PHRASE) + self.assertIn("has been changed", wizard.note) + keyring = EbicsKeyRing(keys=self.userid.ebics_keys_fn, passphrase=NEXT_PHRASE) + self.assertTrue(keyring["#USER"]) + + def test_wrong_old_passphrase(self): + with self.assertRaisesRegex(UserError, "Incorrect old passphrase"): + self._change( + old_pass=WRONG_PHRASE, + new_pass=NEXT_PHRASE, + new_pass_check=NEXT_PHRASE, + ) + + def test_verification_mismatch(self): + with self.assertRaisesRegex(UserError, "verification error"): + self._change(new_pass=NEXT_PHRASE, new_pass_check=OTHER_PHRASE) + + def test_new_equals_old(self): + with self.assertRaisesRegex(UserError, "equal to old"): + self._change(new_pass=INIT_PHRASE, new_pass_check=INIT_PHRASE) + + def test_wrong_old_passphrase_not_stored(self): + """Without a stored passphrase, fintech rejects the wrong one.""" + self.userid.ebics_passphrase_store = False + self.userid.ebics_passphrase = False + with self.assertRaisesRegex(UserError, "(?i)passphrase"): + self._change( + old_pass=WRONG_PHRASE, + new_pass=NEXT_PHRASE, + new_pass_check=NEXT_PHRASE, + ) + + def test_change_passphrase_not_stored(self): + """The new passphrase must not be written when storing is off.""" + self.userid.ebics_passphrase_store = False + self.userid.ebics_passphrase = False + wizard = self._change( + old_pass=INIT_PHRASE, + new_pass=NEXT_PHRASE, + new_pass_check=NEXT_PHRASE, + ) + self.assertFalse(self.userid.ebics_passphrase) + self.assertIn("has been changed", wizard.note) + keyring = EbicsKeyRing(keys=self.userid.ebics_keys_fn, passphrase=NEXT_PHRASE) + self.assertTrue(keyring["#USER"]) + + +class FakeAdminClient: + def __init__(self, error=None): + self.error = error + + def _order(self, name): + if self.error: + raise self.error + return {"order": name, "Services": [{"ServiceName": "SCT"}]} + + def HAA(self, parsed=False): + return self._order("HAA") + + def HPD(self, parsed=False): + return self._order("HPD") + + def HKD(self, parsed=False): + return self._order("HKD") + + def HTD(self, parsed=False): + return self._order("HTD") + + +@tagged("post_install", "-at_install") +class TestAdminOrder(EbicsKeysCommon): + def _run(self, order_type, client): + wizard = self.env["ebics.admin.order"].create( + { + "ebics_config_id": self.ebics_config.id, + "ebics_userid_id": self.ebics_userid.id, + "admin_order_type": order_type, + } + ) + wizard_class = type(wizard) + with patch.object(wizard_class, "_setup_client", return_value=client): + wizard.ebics_admin_order() + return wizard + + def test_admin_orders(self): + for order_type in ("HAA", "HPD", "HKD", "HTD"): + with self.subTest(order_type=order_type): + wizard = self._run(order_type, FakeAdminClient()) + expected = pprint.PrettyPrinter().pformat( + FakeAdminClient()._order(order_type) + ) + self.assertEqual(wizard.note, expected) + + def test_admin_order_errors(self): + cases = [ + (EbicsTechnicalError("061001", "EBICS_AUTHENTICATION_FAILED"), "Technical"), + ( + EbicsFunctionalError("091005", "EBICS_NO_DOWNLOAD_DATA_AVAILABLE"), + "Functional", + ), + ] + for error, expected in cases: + with self.subTest(error=type(error).__name__): + wizard = self._run("HAA", FakeAdminClient(error=error)) + self.assertIn( + f"EBICS {expected} Error during execution of order HAA", wizard.note + ) + self.assertIn(f"(code: {error.code})", wizard.note) + + def test_admin_order_client_setup_failure(self): + wizard = self._run("HPD", False) + self.assertIn("client setup failed", wizard.note) diff --git a/account_ebics/tests/test_ebics_config.py b/account_ebics/tests/test_ebics_config.py new file mode 100644 index 0000000..5641355 --- /dev/null +++ b/account_ebics/tests/test_ebics_config.py @@ -0,0 +1,52 @@ +# Copyright 2026 Noviat. +# License LGPL-3 or later (https://www.gnu.org/licenses/lgpl). + +from odoo.exceptions import UserError +from odoo.tests import tagged + +from .common import EbicsTestCommon + +IBAN_FOR_COMPANY_TEST = "FR7630004000031234567890143" + + +@tagged("post_install", "-at_install") +class TestEbicsConfig(EbicsTestCommon): + def test_update_order_number(self): + cases = [ + ("A000", "A001"), + ("A009", "A00A"), + ("A00Z", "A010"), + ("A0Z9", "A0ZA"), + ("AZZZ", "B000"), + ("ZZZY", "A000"), + # ZZZZ is accepted by the constraint, it must wrap as well + ("ZZZZ", "A000"), + ] + for current, expected in cases: + with self.subTest(current=current): + self.ebics_config._update_order_number(current) + self.assertEqual(self.ebics_config.order_number, expected) + + def test_order_number_pattern(self): + for valid in ("A000", "B1Z9", "ZZZZ"): + with self.subTest(valid=valid): + self.ebics_config.order_number = valid + # No 5-character case: Char(size=4) truncates before the constraint runs. + for invalid in ("a001", "A01", "1000", "A-01"): + with self.subTest(invalid=invalid), self.assertRaises(UserError): + self.ebics_config.order_number = invalid + + def test_unlink_confirmed_config_is_blocked(self): + with self.assertRaises(UserError): + self.ebics_config.unlink() + + def test_unlink_draft_config(self): + self.ebics_userid.unlink() + self.ebics_config.set_to_draft() + self.ebics_config.unlink() + self.assertFalse(self.ebics_config.exists()) + + def test_company_ids_follow_journals(self): + journal = self._create_bank_journal("TCMP", IBAN_FOR_COMPANY_TEST) + self.assertEqual(self.ebics_config.company_ids, journal.company_id) + self.assertEqual(journal.ebics_config_id, self.ebics_config) diff --git a/account_ebics/tests/test_ebics_file.py b/account_ebics/tests/test_ebics_file.py new file mode 100644 index 0000000..b9dcc68 --- /dev/null +++ b/account_ebics/tests/test_ebics_file.py @@ -0,0 +1,170 @@ +# Copyright 2026 Noviat. +# License LGPL-3 or later (https://www.gnu.org/licenses/lgpl). + +from unittest.mock import patch + +from odoo import Command +from odoo.exceptions import UserError +from odoo.tests import tagged + +from .common import IBAN_SPK, EbicsTestCommon + + +@tagged("post_install", "-at_install") +class TestEbicsFile(EbicsTestCommon): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.journal = cls._create_bank_journal("TSPK", IBAN_SPK) + + def _statement(self, name, date="2026-10-13", import_format="camt053"): + statement = self.env["account.bank.statement"].create( + { + "name": name, + "journal_id": self.journal.id, + "line_ids": [ + Command.create( + { + "journal_id": self.journal.id, + "date": date, + "payment_ref": f"line {name}", + "amount": 10.0, + } + ) + ], + } + ) + statement.import_format = import_format + return statement + + def test_duplicate_statement_is_removed(self): + self._statement("ST-1") + duplicate = self._statement("ST-1") + res = self._new_res() + res["statement_ids"] = duplicate.ids + ebics_file = self._create_ebics_file("camt053_sparkasse.xml", self.ff_camt053) + kept = ebics_file._statement_duplicate_check(res, duplicate) + self.assertFalse(kept) + self.assertFalse(duplicate.exists()) + self.assertEqual(res["statement_ids"], []) + self.assertEqual(res["notifications"][0]["type"], "warning") + self.assertIn("ST-1", res["notifications"][0]["message"]) + + def test_duplicate_check_scope(self): + """A checked statement only collides with the same name, date and format.""" + # existing statements: same name, other date / same name, other format + self._statement("ST-2", date="2026-10-14") + self._statement("ST-2", import_format="cfonb120") + new = self._statement("ST-2") + # outside DUP_CHECK_FORMATS: never checked + unchecked = self._statement("ST-2", import_format="camt052") + statements = new | unchecked + res = self._new_res() + res["statement_ids"] = statements.ids + ebics_file = self._create_ebics_file("camt053_sparkasse.xml", self.ff_camt053) + kept = ebics_file._statement_duplicate_check(res, statements) + self.assertEqual(kept, statements) + self.assertFalse(res["notifications"]) + + def test_process_result_note(self): + ebics_file = self._create_ebics_file("camt053_sparkasse.xml", self.ff_camt053) + ebics_file.note_process = "" + statement = self._statement("ST-3") + res = { + "statement_ids": statement.ids, + "notifications": [ + {"type": "error", "message": "Broken entry", "details": "line 4"}, + {"type": "warning", "message": "Odd balance"}, + {"info": "Something to know"}, + "Plain text warning", + ], + } + ebics_file._process_download_result(res, file_format="camt053") + note = ebics_file.note_process + self.assertIn("Broken entry\nline 4", note) + self.assertIn("Number of errors: 1", note) + self.assertIn("Number of warnings: 3", note) + self.assertIn("1 bank statement has been imported", note) + self.assertEqual(ebics_file.bank_statement_ids, statement) + self.assertEqual(statement.import_format, "camt053") + self.assertEqual(ebics_file.company_ids, self.company) + + def test_process_result_empty_file(self): + ebics_file = self._create_ebics_file("camt053_sparkasse.xml", self.ff_camt053) + ebics_file.note_process = "" + ebics_file._process_download_result(self._new_res(), file_format="camt053") + self.assertIn("doesn't contain any transaction", ebics_file.note_process) + + def test_unlink_done_file_is_blocked(self): + ebics_file = self._create_ebics_file("camt053_sparkasse.xml", self.ff_camt053) + ebics_file.set_to_done() + with self.assertRaises(UserError): + ebics_file.unlink() + + def test_unlink_removes_statements(self): + ebics_file = self._create_ebics_file("camt053_sparkasse.xml", self.ff_camt053) + statement = self._statement("ST-4") + statement.ebics_file_id = ebics_file + ebics_file.unlink() + self.assertFalse(statement.exists()) + + def test_unlink_pain002_file(self): + """pain.002 processing is a placeholder: its files must stay removable.""" + ebics_file = self._create_ebics_file( + "ptk_protocol.txt", self.env.ref("account_ebics.ebics_ff_Z01") + ) + ebics_file.unlink() + self.assertFalse(ebics_file.exists()) + + def test_process_format_without_method(self): + """Modelled on a Sparkasse customer protocol (PTK): stored, not processed.""" + ptk = self.env["ebics.file.format"].create( + {"name": "PTK", "type": "down", "order_type": "PTK", "suffix": "txt"} + ) + ebics_file = self._create_ebics_file("ptk_protocol.txt", ptk) + with self.assertRaisesRegex(UserError, "no support"): + ebics_file.process() + + def test_check_import_module(self): + ebics_file = self._create_ebics_file("camt053_sparkasse.xml", self.ff_camt053) + self.assertTrue(ebics_file._check_import_module("account_ebics")) + self.assertFalse( + ebics_file._check_import_module("no_such_module", raise_if_not_found=False) + ) + with self.assertRaises(UserError): + ebics_file._check_import_module("no_such_module") + + def test_enterprise_import_does_not_commit_in_tests(self): + """The Enterprise path commits after each statement in production.""" + ebics_file = self._create_ebics_file("camt053_sparkasse.xml", self.ff_camt053) + statement = self._statement("ST-5") + st_datas = [{"acc_number": "0010000002", "journal_id": self.journal.id}] + + def create_statement(res, st_data): + res["statement_ids"].append(statement.id) + + file_class = type(ebics_file) + cursor_class = type(self.env.cr) + res = self._new_res() + with ( + patch.object( + file_class, "_create_bank_statement_oe", side_effect=create_statement + ), + patch.object(cursor_class, "commit", side_effect=AssertionError("commit")), + ): + ebics_file._process_bank_statement_oe(res, st_datas) + self.assertEqual(res["statement_ids"], statement.ids) + self.assertFalse(res["notifications"]) + + def test_enterprise_import_reports_errors(self): + ebics_file = self._create_ebics_file("camt053_sparkasse.xml", self.ff_camt053) + st_datas = [{"acc_number": "0010000002", "journal_id": self.journal.id}] + res = self._new_res() + with patch.object( + type(ebics_file), + "_create_bank_statement_oe", + side_effect=UserError("Journal mismatch"), + ): + ebics_file._process_bank_statement_oe(res, st_datas) + self.assertIn("Journal mismatch", res["notifications"][0]["message"]) + self.assertIn("0010000002", res["notifications"][0]["message"]) diff --git a/account_ebics/tests/test_ebics_file_split.py b/account_ebics/tests/test_ebics_file_split.py new file mode 100644 index 0000000..9837c6a --- /dev/null +++ b/account_ebics/tests/test_ebics_file_split.py @@ -0,0 +1,232 @@ +# Copyright 2026 Noviat. +# License LGPL-3 or later (https://www.gnu.org/licenses/lgpl). + +import base64 + +from lxml import etree + +from odoo.tests import tagged + +from .common import ( + IBAN_CA833, + IBAN_CA879, + IBAN_CIC, + IBAN_CMB, + IBAN_HVB, + IBAN_LCL, + IBAN_MULTI, + IBAN_SPK, + IBAN_SUFFIX, + EbicsTestCommon, +) + + +@tagged("post_install", "-at_install") +class TestSplitCfonb(EbicsTestCommon): + """EBICS files may hold several accounts and empty statements: they are + split per statement before being handed to the CFONB parser.""" + + def _split(self, sample): + ebics_file = self._create_ebics_file(sample, self.ff_cfonb120) + res = self._new_res() + return ebics_file._split_cfonb(res), res + + def _lines(self, st_data): + return base64.b64decode(st_data["data"]).decode("latin-1").splitlines() + + def test_no_line_terminator_single_account(self): + """Modelled on Crédit Mutuel de Bretagne: no line terminator at all.""" + journal = self._create_bank_journal("TCMB", IBAN_CMB) + datas, res = self._split("cfonb120_no_eol_single_account.dat") + self.assertFalse(res["notifications"]) + self.assertEqual(len(datas), 1) + self.assertEqual(datas[0]["acc_number"], "10000000101") + self.assertEqual(datas[0]["journal_id"], journal.id) + self.assertEqual(datas[0]["company_id"], self.company.id) + lines = self._lines(datas[0]) + self.assertEqual( + [x[:2] for x in lines], ["01", "04", "05", "05", "04", "05", "07"] + ) + self.assertTrue(all(len(x) == 120 for x in lines)) + + def test_empty_statements_only(self): + self._create_bank_journal("TCMB", IBAN_CMB) + datas, res = self._split("cfonb120_no_eol_empty_only.dat") + self.assertEqual(datas, []) + self.assertFalse(res["notifications"]) + + def test_multi_account_with_complement_lines(self): + """Modelled on Crédit Agricole: 3 accounts, the middle one empty, and a + positive-zero overpunch ('{') on its balance.""" + j1 = self._create_bank_journal("TCA1", IBAN_CA833[0]) + j3 = self._create_bank_journal("TCA3", IBAN_CA833[2]) + datas, res = self._split("cfonb120_lf_multi_account_05.dat") + self.assertFalse(res["notifications"]) + self.assertEqual([d["journal_id"] for d in datas], [j1.id, j3.id]) + self.assertEqual( + [x[:2] for x in self._lines(datas[0])], + ["01", "04", "05", "05", "05", "04", "05", "05", "07"], + ) + + def test_multi_account_missing_journal(self): + self._create_bank_journal("TCA1", IBAN_CA833[0]) + datas, res = self._split("cfonb120_lf_multi_account_05.dat") + self.assertEqual(len(datas), 1) + self.assertEqual(len(res["notifications"]), 1) + self.assertEqual(res["notifications"][0]["type"], "error") + self.assertIn("20000000203", res["notifications"][0]["message"]) + + def test_no_line_terminator_mixed_empty_and_full(self): + """Modelled on LCL: 4 accounts, no terminator, empty and full mixed.""" + journals = [ + self._create_bank_journal(f"TLC{i}", iban) + for i, iban in enumerate(IBAN_LCL) + ] + datas, res = self._split("cfonb120_no_eol_multi_account_mixed.dat") + self.assertFalse(res["notifications"]) + self.assertEqual( + [d["journal_id"] for d in datas], [journals[1].id, journals[3].id] + ) + + def test_minimal_file_without_complement_lines(self): + """Modelled on Crédit Agricole 879: no 05 records, an account label in + the free zone of 01 and dashes in 07, three empty statements before + the only one with transactions.""" + journal = self._create_bank_journal("TCA9", IBAN_CA879[3]) + datas, res = self._split("cfonb120_lf_minimal_no_05.dat") + self.assertFalse(res["notifications"]) + self.assertEqual(len(datas), 1) + self.assertEqual(datas[0]["journal_id"], journal.id) + self.assertEqual( + [x[:2] for x in self._lines(datas[0])], ["01", "04", "04", "07"] + ) + + def test_rich_complement_lines_are_kept(self): + """Modelled on CIC: every 05 qualifier stays with its statement.""" + self._create_bank_journal("TCIC", IBAN_CIC) + datas, res = self._split("cfonb120_lf_rich_05.dat") + self.assertFalse(res["notifications"]) + self.assertEqual(len(datas), 1) + qualifiers = [x[45:48] for x in self._lines(datas[0]) if x[:2] == "05"] + self.assertEqual( + qualifiers, + ["NOM", "RIB", "IBE", "CBE", "LCC", "RCN", "REF", "NPY", "RUM", "LIB"], + ) + + def test_bad_length(self): + datas, res = self._split("cfonb120_bad_length.dat") + self.assertEqual(datas, []) + self.assertEqual(res["notifications"][0]["type"], "error") + self.assertIn("120", res["notifications"][0]["message"]) + + def test_journal_in_other_currency(self): + usd = self.env.ref("base.USD") + self._create_bank_journal("TCMB", IBAN_CMB, currency=usd) + datas, res = self._split("cfonb120_no_eol_single_account.dat") + self.assertEqual(datas, []) + self.assertEqual(res["notifications"][0]["type"], "error") + + +@tagged("post_install", "-at_install") +class TestSplitCamt(EbicsTestCommon): + def _split(self, sample): + ebics_file = self._create_ebics_file(sample, self.ff_camt053) + res = self._new_res() + return ebics_file._split_camt(res), res + + def _statements(self, st_data): + root = etree.fromstring(base64.b64decode(st_data["data"])) + ns = {"ns": root.nsmap[None]} + return root.xpath("//ns:Stmt/ns:Acct/ns:Id//text()", namespaces=ns) + + def test_single_statement_clav_fx(self): + """Modelled on UniCredit HVB: OPBD/CLBD/CLAV balances, FX entry.""" + journal = self._create_bank_journal("THVB", IBAN_HVB) + datas, res = self._split("camt053_hvb_clav_fx.xml") + self.assertFalse(res["notifications"]) + self.assertEqual(len(datas), 1) + self.assertEqual(datas[0]["journal_id"], journal.id) + self.assertEqual(datas[0]["acc_number"], IBAN_HVB) + + def test_multi_account_is_split(self): + j1 = self._create_bank_journal("TMU1", IBAN_MULTI[0]) + j2 = self._create_bank_journal("TMU2", IBAN_MULTI[1]) + datas, res = self._split("camt053_multi_account.xml") + self.assertFalse(res["notifications"]) + self.assertEqual([d["journal_id"] for d in datas], [j1.id, j2.id]) + self.assertEqual(self._statements(datas[0]), [IBAN_MULTI[0]]) + self.assertEqual(self._statements(datas[1]), [IBAN_MULTI[1]]) + + def test_currency_suffix_is_stripped(self): + """Built from the code: some banks (e.g. Commerzbank) append the + currency to the account number.""" + journal = self._create_bank_journal("TSUF", IBAN_SUFFIX) + datas, res = self._split("camt053_currency_suffix.xml") + self.assertFalse(res["notifications"]) + self.assertEqual(datas[0]["acc_number"], "0010000005") + self.assertEqual(datas[0]["journal_id"], journal.id) + + def test_statement_without_entries_is_skipped(self): + self._create_bank_journal("TSPK", IBAN_SPK) + datas, res = self._split("camt053_no_entries.xml") + self.assertEqual(datas, []) + self.assertFalse(res["notifications"]) + + def test_statement_without_account(self): + datas, res = self._split("camt053_no_account.xml") + self.assertEqual(datas, []) + self.assertEqual(res["notifications"][0]["type"], "error") + self.assertIn( + "No bank account number found", res["notifications"][0]["message"] + ) + + def test_invalid_xml(self): + datas, res = self._split("invalid.xml") + self.assertEqual(datas, []) + self.assertEqual(res["notifications"][0]["type"], "error") + self.assertIn("Invalid XML", res["notifications"][0]["message"]) + + +@tagged("post_install", "-at_install") +class TestLookupJournal(EbicsTestCommon): + def setUp(self): + super().setUp() + self.ebics_file = self._create_ebics_file( + "camt053_sparkasse.xml", self.ff_camt053 + ) + self.res = self._new_res() + + def test_unknown_currency(self): + currency, journal = self.ebics_file._lookup_journal( + self.res, "0010000002", "XYZ" + ) + self.assertFalse(currency) + self.assertFalse(journal) + self.assertIn("XYZ", self.res["notifications"][0]["message"]) + + def test_no_journal(self): + currency, journal = self.ebics_file._lookup_journal( + self.res, "0010000002", "EUR" + ) + self.assertEqual(currency, self.eur) + self.assertFalse(journal) + self.assertEqual(self.res["notifications"][0]["type"], "error") + + def test_journal_currency_match(self): + expected = self._create_bank_journal("TSPK", IBAN_SPK) + currency, journal = self.ebics_file._lookup_journal( + self.res, "0010000002", "eur" + ) + self.assertEqual(currency, self.eur) + self.assertEqual(journal, expected) + self.assertFalse(self.res["notifications"]) + + def test_journal_without_currency_uses_company_currency(self): + expected = self._create_bank_journal("TSPK", IBAN_SPK) + expected.sudo().currency_id = False + code = self.company.currency_id.name + currency, journal = self.ebics_file._lookup_journal( + self.res, "0010000002", code + ) + self.assertEqual(currency, self.company.currency_id) + self.assertEqual(journal, expected) diff --git a/account_ebics/tests/test_ebics_userid.py b/account_ebics/tests/test_ebics_userid.py new file mode 100644 index 0000000..a1a9c2a --- /dev/null +++ b/account_ebics/tests/test_ebics_userid.py @@ -0,0 +1,284 @@ +# Copyright 2026 Noviat. +# License LGPL-3 or later (https://www.gnu.org/licenses/lgpl). + +import base64 +import gc +import itertools +import os +import shutil +import tempfile +from unittest.mock import patch +from urllib.error import URLError + +from fintech.ebics import EbicsFunctionalError, EbicsKeyRing, EbicsTechnicalError + +from odoo import Command, fields +from odoo.exceptions import UserError +from odoo.tests import tagged +from odoo.tools import mute_logger + +from odoo.addons.account_ebics.models import ebics_userid as ebics_userid_module + +from .common import EbicsTestCommon + +# Throwaway passphrase for keys created in a temporary directory. +WRONG_PHRASE = "wrong-passphrase" +PUBLIC_BANK_KEYS = ( + "Public bank keys (simulated)\nX002 hash: 00 11 22\nE002 hash: 33 44 55\n" +) + + +def fake_init_client(hev=None, ini_error=None, hpb_error=None): + """Return a stand-in for fintech's EbicsClient covering the bank side of + the key ceremony. Keys, certificates and the INI letter stay real.""" + + class FakeInitClient: + calls = [] + + def __init__(self, bank, user, version=None): + self.bank = bank + + def HEV(self): + self.calls.append("HEV") + return hev if hev is not None else {"H004": "2.5", "H005": "3.0"} + + def _order(self, name): + self.calls.append(name) + return self.bank._next_order_id("PARTNER1") + + def INI(self): + if ini_error: + raise ini_error + return self._order("INI") + + def HIA(self): + return self._order("HIA") + + def HPB(self): + if hpb_error: + raise hpb_error + self.calls.append("HPB") + return PUBLIC_BANK_KEYS + + return FakeInitClient + + +class EbicsKeysCommon(EbicsTestCommon): + """Real keys in a temporary directory, simulated bank.""" + + _userid_seq = itertools.count(1) + + @classmethod + def setUpClass(cls): + super().setUpClass() + keys_dir = tempfile.mkdtemp(prefix="ebics_keys_test_") + cls.addClassCleanup(shutil.rmtree, keys_dir, ignore_errors=True) + cls.ebics_config.write({"ebics_keys": keys_dir, "ebics_key_bitlength": 2048}) + cls.bank_fr = cls.env["res.bank"].create( + {"name": "Banque Test", "country": cls.env.ref("base.fr").id} + ) + cls.journal = cls._create_bank_journal("TKEY", "FR7630004000031234567890143") + cls.journal.bank_account_id.sudo().bank_id = cls.bank_fr + + def _new_userid(self, **vals): + # A new name per test: fintech keeps open keyrings per file in-process. + return self.env["ebics.userid"].create( + { + "name": f"KEYUSER{next(self._userid_seq)}", + "ebics_config_id": self.ebics_config.id, + "user_ids": [Command.set(self.env.user.ids)], + "company_ids": [Command.set(self.company.ids)], + "ebics_passphrase": "init-passphrase", + **vals, + } + ) + + def _init_1(self, userid, client_class=None): + client_class = client_class or fake_init_client() + with patch.object(ebics_userid_module, "EbicsClient", client_class): + userid.ebics_init_1() + return client_class + + +@tagged("post_install", "-at_install") +class TestKeyCeremony(EbicsKeysCommon): + def test_full_ceremony(self): + userid = self._new_userid(ebics_key_x509=True, ebics_key_x509_dn_cn="Test") + client_class = self._init_1(userid) + self.assertEqual(client_class.calls, ["HEV", "INI", "HIA"]) + self.assertEqual(userid.state, "init") + self.assertTrue(os.path.isfile(userid.ebics_keys_fn)) + self.assertTrue(userid.ebics_keys_found) + self.assertTrue(base64.b64decode(userid.ebics_ini_letter).startswith(b"%PDF")) + today = fields.Date.today().isoformat() + self.assertEqual(userid.ebics_ini_letter_fn, f"TESTHOST_ini_letter_{today}.pdf") + + userid.ebics_init_2() + self.assertEqual(userid.state, "get_bank_keys") + + with patch.object(ebics_userid_module, "EbicsClient", client_class): + userid.ebics_init_3() + self.assertEqual(userid.state, "to_verify") + self.assertEqual( + base64.b64decode(userid.ebics_public_bank_keys).decode(), PUBLIC_BANK_KEYS + ) + self.assertEqual( + userid.ebics_public_bank_keys_fn, f"TESTHOST_public_bank_keys_{today}.txt" + ) + + bank_class = ebics_userid_module.EbicsBank + with patch.object(bank_class, "activate_keys") as activate_keys: + userid.ebics_init_4() + activate_keys.assert_called_once() + self.assertEqual(userid.state, "active_keys") + # stored passphrase is kept + self.assertEqual(userid.ebics_passphrase, "init-passphrase") + + def test_passphrase_not_stored_is_cleared(self): + userid = self._new_userid(ebics_passphrase_store=False) + self._init_1(userid) + self.assertFalse(userid.ebics_passphrase) + + def test_existing_keys_are_kept(self): + """A second init reuses the key file: reset tools must delete it.""" + userid = self._new_userid() + self._init_1(userid) + with open(userid.ebics_keys_fn, "rb") as f: + keys = f.read() + userid.set_to_draft() + self._init_1(userid) + with open(userid.ebics_keys_fn, "rb") as f: + self.assertEqual(f.read(), keys) + + def test_step_guards(self): + userid = self._new_userid() + userid.state = "init" + with self.assertRaisesRegex(UserError, "draft"): + userid.ebics_init_1() + userid.state = "draft" + for method in ("ebics_init_2", "ebics_init_3", "ebics_init_4"): + with self.subTest(method=method), self.assertRaises(UserError): + getattr(userid, method)() + + def test_init_requires_passphrase(self): + userid = self._new_userid(ebics_passphrase=False) + with self.assertRaisesRegex(UserError, "passphrase"): + userid.ebics_init_1() + + def test_3skey_requires_certificate(self): + userid = self._new_userid(swift_3skey=True) + with self.assertRaisesRegex(UserError, "3SKey certificate"): + userid.ebics_init_1() + + def test_init_requires_a_journal_with_bank(self): + self.ebics_config.journal_ids = False + userid = self._new_userid() + with self.assertRaisesRegex(UserError, "No bank defined"): + self._init_1(userid) + + def test_version_not_supported_by_bank(self): + userid = self._new_userid() + with self.assertRaisesRegex(UserError, "version mismatch"): + self._init_1(userid, fake_init_client(hev={"H003": "2.4"})) + self.assertEqual(userid.state, "draft") + + def test_init_errors(self): + cases = [ + (URLError("connection refused"), "urlopen error"), + ( + EbicsFunctionalError("091002", "EBICS_INVALID_USER_OR_USER_STATE"), + "091002", + ), + (EbicsTechnicalError("061001", "EBICS_AUTHENTICATION_FAILED"), "061001"), + ] + for error, expected in cases: + with self.subTest(error=type(error).__name__): + userid = self._new_userid() + with ( + mute_logger(ebics_userid_module.__name__), + self.assertRaisesRegex(UserError, expected), + ): + self._init_1(userid, fake_init_client(ini_error=error)) + + def test_get_bank_keys_error(self): + userid = self._new_userid() + self._init_1(userid) + userid.ebics_init_2() + error = EbicsFunctionalError("091002", "EBICS_INVALID_USER_OR_USER_STATE") + client_class = fake_init_client(hpb_error=error) + with ( + patch.object(ebics_userid_module, "EbicsClient", client_class), + self.assertRaisesRegex(UserError, "EBICS Functional Error"), + ): + userid.ebics_init_3() + + def test_h003_order_numbers(self): + self.ebics_config.write({"ebics_version": "H003", "order_number": "A000"}) + userid = self._new_userid() + self._init_1(userid, fake_init_client(hev={"H003": "2.4"})) + # INI uses A000, HIA uses A001 + self.assertEqual(self.ebics_config.order_number, "A002") + + def test_ini_letter_language(self): + calls = [] + + class SpyUser(ebics_userid_module.EbicsUser): + def create_ini_letter(self, bankname, lang=None, **kwargs): + calls.append((bankname, lang)) + return b"%PDF-1.4 spy" + + cases = [ + ("base.fr", "fr_FR", "fr"), + ("base.de", "fr_FR", "de"), + ("base.be", "fr_FR", "fr"), + ("base.be", "en_US", "en"), + ] + for country, user_lang, expected in cases: + with self.subTest(country=country, user_lang=user_lang): + lang = ( + self.env["res.lang"] + .sudo() + .with_context(active_test=False) + .search([("code", "=", user_lang)]) + ) + lang.active = True + self.bank_fr.country = self.env.ref(country) + self.env.user.lang = user_lang + userid = self._new_userid() + with patch.object(ebics_userid_module, "EbicsUser", SpyUser): + self._init_1(userid) + self.assertEqual(calls[-1], ("Banque Test", expected)) + + def test_key_renewal_requires_draft_config(self): + userid = self._new_userid() + with self.assertRaisesRegex(UserError, "Key Renewal"): + userid.set_to_get_bank_keys() + self.ebics_config.set_to_draft() + userid.set_to_get_bank_keys() + self.assertEqual(userid.state, "get_bank_keys") + + def test_h005_requires_x509(self): + self.ebics_config.ebics_version = "H005" + with self.assertRaisesRegex(UserError, "X.509"): + self._new_userid(ebics_key_x509=False) + + def test_stored_passphrase_is_checked(self): + userid = self._new_userid() + self._init_1(userid) + gc.collect() # no other keyring instance: fintech raises ValueError + userid.ebics_passphrase = WRONG_PHRASE + with self.assertRaisesRegex(UserError, "Passphrase mismatch"): + userid._onchange_ebics_passphrase_store() + + def test_stored_passphrase_is_checked_with_open_keyring(self): + """In a worker the keyring may already be open with the right + passphrase: fintech then raises RuntimeError.""" + userid = self._new_userid() + self._init_1(userid) + open_keyring = EbicsKeyRing( + keys=userid.ebics_keys_fn, passphrase=userid.ebics_passphrase + ) + userid.ebics_passphrase = WRONG_PHRASE + with self.assertRaisesRegex(UserError, "Passphrase mismatch"): + userid._onchange_ebics_passphrase_store() + del open_keyring diff --git a/account_ebics/tests/test_ebics_xfer.py b/account_ebics/tests/test_ebics_xfer.py new file mode 100644 index 0000000..f27b561 --- /dev/null +++ b/account_ebics/tests/test_ebics_xfer.py @@ -0,0 +1,245 @@ +# Copyright 2026 Noviat. +# License LGPL-3 or later (https://www.gnu.org/licenses/lgpl). + +import base64 +from datetime import date + +from fintech.ebics import ( + EbicsFunctionalError, + EbicsTechnicalError, + EbicsVerificationError, +) + +from odoo.tests import tagged + +from .common import EbicsTestCommon, FakeEbicsClient, read_sample + + +@tagged("post_install", "-at_install") +class TestEbicsXferDownload(EbicsTestCommon): + def test_line_terminator(self): + xfer = self.env["ebics.xfer"] + line_a, line_b = b"A" * 120, b"B" * 120 + self.assertEqual( + xfer._handle_cfonb120(line_a + line_b), line_a + b"\n" + line_b + b"\n" + ) + self.assertEqual( + xfer._handle_cfonb120(line_a + b"\r\n" + line_b + b"\r\n"), + line_a + b"\n" + line_b + b"\n", + ) + self.assertEqual( + xfer._handle_cfonb240(line_a + line_b), line_a + line_b + b"\n" + ) + # Current behaviour: an incomplete trailing line is dropped. + self.assertEqual(xfer._handle_cfonb120(line_a + b"C" * 10), line_a + b"\n") + + def test_download_fdl_cfonb(self): + data = read_sample("cfonb120_no_eol_single_account.dat") + wizard = self._download_wizard(self.ff_cfonb120, date_to=date(2026, 10, 13)) + with self._fake_client(FakeEbicsClient(downloads={"FDL": data})) as client: + action = wizard.ebics_download() + self.assertEqual(action["context"]["err_cnt"], 0) + ebics_file = self.env["ebics.file"].browse(action["context"]["ebics_file_ids"]) + self.assertEqual(ebics_file.name, "TESTHOST_PARTNER1_2026-10-13.cfonb120.dat") + self.assertEqual(ebics_file.state, "draft") + self.assertEqual(ebics_file.ebics_userid_id, self.ebics_userid) + self.assertEqual(ebics_file.company_ids, self.ebics_config.company_ids) + # FDL CFONB downloads get a line terminator every 120 characters + stored = base64.b64decode(ebics_file.data) + self.assertEqual(stored.count(b"\n"), 7) + self.assertEqual(client.confirmed, [("TRANS0001", True)]) + self.assertIn("is available for further processing", wizard.note) + + def test_download_btd_cfonb(self): + data = read_sample("cfonb120_no_eol_single_account.dat") + wizard = self._download_wizard(self.ff_btd_cfonb120, date_to=date(2026, 10, 13)) + with self._fake_client(FakeEbicsClient(downloads={"BTD": data})): + action = wizard.ebics_download() + ebics_file = self.env["ebics.file"].browse(action["context"]["ebics_file_ids"]) + self.assertEqual(len(ebics_file), 1) + # BTD formats have no name, hence no line terminator handler. + self.assertEqual(base64.b64decode(ebics_file.data), data) + + def test_same_name_in_another_format(self): + """FDL and BTD CFONB formats share the file suffix: same file name, + but a different format is not a duplicate.""" + data = read_sample("cfonb120_no_eol_single_account.dat") + names = [] + for file_format, order_type in ( + (self.ff_cfonb120, "FDL"), + (self.ff_btd_cfonb120, "BTD"), + ): + wizard = self._download_wizard(file_format, date_to=date(2026, 10, 13)) + client = FakeEbicsClient(downloads={order_type: data}) + with self._fake_client(client): + action = wizard.ebics_download() + self.assertEqual(action["context"]["err_cnt"], 0) + ebics_file = self.env["ebics.file"].browse( + action["context"]["ebics_file_ids"] + ) + names.append(ebics_file.name) + self.assertEqual(names[0], names[1]) + + def test_download_same_file_twice(self): + data = read_sample("cfonb120_no_eol_single_account.dat") + for expected_errors in (0, 1): + wizard = self._download_wizard(self.ff_cfonb120, date_to=date(2026, 10, 13)) + with self._fake_client(FakeEbicsClient(downloads={"FDL": data})) as client: + action = wizard.ebics_download() + self.assertEqual(action["context"]["err_cnt"], expected_errors) + self.assertIn("has already been downloaded", wizard.note) + self.assertEqual(client.confirmed, [("TRANS0001", False)]) + + def test_download_several_documents(self): + ptk = self.env["ebics.file.format"].create( + {"name": "PTK", "type": "down", "order_type": "PTK", "suffix": "txt"} + ) + data = read_sample("ptk_protocol.txt") + wizard = self._download_wizard(ptk) + client = FakeEbicsClient(downloads={"PTK": {"doc1": data, "doc2": data}}) + with self._fake_client(client): + action = wizard.ebics_download() + ebics_files = self.env["ebics.file"].browse(action["context"]["ebics_file_ids"]) + self.assertEqual( + sorted(ebics_files.mapped("name")), + ["TESTHOST_PARTNER1_doc1.txt", "TESTHOST_PARTNER1_doc2.txt"], + ) + # no processing method: the files are done right away + self.assertEqual(set(ebics_files.mapped("state")), {"done"}) + + def test_mark_as_downloaded(self): + data = read_sample("cfonb120_no_eol_single_account.dat") + wizard = self._download_wizard(self.ff_cfonb120).with_context( + ebics_mark_as_downloaded=True + ) + with self._fake_client(FakeEbicsClient(downloads={"FDL": data})) as client: + action = wizard.ebics_download() + self.assertFalse(action["context"]["ebics_file_ids"]) + self.assertEqual(client.confirmed, [("TRANS0001", True)]) + + def test_download_errors(self): + cases = [ + ( + EbicsFunctionalError("091005", "EBICS_NO_DOWNLOAD_DATA_AVAILABLE"), + "EBICS Functional Error", + "EBICS_NO_DOWNLOAD_DATA_AVAILABLE (code: 091005)", + ), + ( + EbicsTechnicalError("061002", "EBICS_INVALID_REQUEST"), + "EBICS Technical Error", + "EBICS_INVALID_REQUEST (code: 061002)", + ), + ( + EbicsVerificationError(), + "EBICS Verification Error", + "could not be verified", + ), + (RuntimeError("socket closed"), "Unknown Error", "socket closed"), + ] + for error, title, detail in cases: + with self.subTest(error=type(error).__name__): + wizard = self._download_wizard(self.ff_cfonb120) + with self._fake_client(FakeEbicsClient(error=error)) as client: + action = wizard.ebics_download() + self.assertEqual(action["context"]["err_cnt"], 1) + self.assertFalse(action["context"]["ebics_file_ids"]) + self.assertIn(title, wizard.note) + self.assertIn(detail, wizard.note) + self.assertEqual(client.confirmed, [("TRANS0001", False)]) + + def test_client_setup_failure(self): + wizard = self._download_wizard(self.ff_cfonb120) + with self._fake_client(False): + action = wizard.ebics_download() + self.assertEqual(action["context"]["err_cnt"], 1) + self.assertIn("client setup failed", wizard.note) + + +@tagged("post_install", "-at_install") +class TestEbicsXferUpload(EbicsTestCommon): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.ff_btu = cls.env["ebics.file.format"].create( + { + "type": "up", + "order_type": "BTU", + "btf_service": "SCT", + "btf_message": "pain.001", + "suffix": "xml", + } + ) + cls.ff_ful = cls.env.ref("account_ebics.ebics_ff_LCR") + bank = cls.env["res.bank"].create( + {"name": "Test Bank FR", "country": cls.env.ref("base.fr").id} + ) + journal = cls._create_bank_journal("TUPL", "FR7630004000031234567890143") + journal.bank_account_id.sudo().bank_id = bank + + def test_upload_btu(self): + wizard = self._upload_wizard(self.ff_btu, test_mode=True) + with self._fake_client(FakeEbicsClient(order_id="N042")) as client: + ebics_file = wizard._ebics_upload() + self.assertEqual(ebics_file.name, "pay.xml") + self.assertEqual(ebics_file.state, "done") + self.assertEqual(ebics_file.pain_state, "uploaded") + self.assertEqual(ebics_file.ebics_order_number, "N042") + self.assertEqual(client.uploads, [("BTU", b"", {"TEST": "TRUE"})]) + self.assertIn("OrderID N042", wizard.note) + # H004: the order number is managed by the bank + self.assertFalse(self.ebics_config.order_number) + + def test_upload_same_name_twice(self): + names = [] + for _i in range(3): + wizard = self._upload_wizard(self.ff_btu) + with self._fake_client(FakeEbicsClient()): + names.append(wizard._ebics_upload().name) + # Pinned, probably unintended: _update_ef_vals appends each counter to + # the previous candidate (pay.xml_1_2) instead of pay.xml_2. + self.assertEqual(names, ["pay.xml", "pay.xml_1", "pay.xml_1_2"]) + + def test_upload_ful_h003_order_number(self): + self.ebics_config.write({"ebics_version": "H003", "order_number": "A00Z"}) + wizard = self._upload_wizard(self.ff_ful, fname="lcr.txt") + with self._fake_client(FakeEbicsClient(order_id="A00Z")) as client: + ebics_file = wizard._ebics_upload() + self.assertEqual(ebics_file.ebics_order_number, "A00Z") + self.assertEqual(client.uploads[0][0], "FUL") + self.assertEqual(client.uploads[0][2], {"country": "FR"}) + self.assertEqual(self.ebics_config.order_number, "A010") + + def test_upload_h003_failure_still_increments(self): + """Pinned behaviour: the order number moves on even if the upload failed.""" + self.ebics_config.write({"ebics_version": "H003", "order_number": "B000"}) + wizard = self._upload_wizard(self.ff_ful, fname="lcr.txt") + error = EbicsFunctionalError("091112", "EBICS_INVALID_ORDER_PARAMS") + with self._fake_client(FakeEbicsClient(error=error)): + ebics_file = wizard._ebics_upload() + self.assertFalse(ebics_file) + self.assertEqual(self.ebics_config.order_number, "B001") + self.assertIn("EBICS Functional Error", wizard.note) + self.assertIn("EBICS_INVALID_ORDER_PARAMS (code: 091112)", wizard.note) + + def test_upload_errors(self): + cases = [ + (EbicsTechnicalError("061001", "EBICS_AUTHENTICATION_FAILED"), "Technical"), + (EbicsVerificationError(), "Verification"), + (RuntimeError("socket closed"), "Unknown Error"), + ] + for error, expected in cases: + with self.subTest(error=type(error).__name__): + wizard = self._upload_wizard(self.ff_btu) + with self._fake_client(FakeEbicsClient(error=error)): + self.assertFalse(wizard._ebics_upload()) + self.assertIn(expected, wizard.note) + + def test_upload_onchange_selects_format(self): + """A single upload format on the config is selected automatically.""" + self.ebics_config.ebics_file_format_ids = self.ff_btu + wizard = self.env["ebics.xfer"].new( + {"ebics_config_id": self.ebics_config.id, "upload_fname": "pay.xml"} + ) + wizard._onchange_ebics_config_id() + self.assertEqual(wizard.format_id, self.ff_btu) + self.assertEqual(wizard.ebics_userid_id, self.ebics_userid) diff --git a/account_ebics/tests/test_ebics_xfer_client.py b/account_ebics/tests/test_ebics_xfer_client.py new file mode 100644 index 0000000..3aaa625 --- /dev/null +++ b/account_ebics/tests/test_ebics_xfer_client.py @@ -0,0 +1,115 @@ +# Copyright 2026 Noviat. +# License LGPL-3 or later (https://www.gnu.org/licenses/lgpl). + +import base64 +from unittest.mock import patch + +from odoo.exceptions import UserError +from odoo.tests import tagged + +from odoo.addons.account_ebics.wizards import ebics_xfer as ebics_xfer_module + +from .test_ebics_userid import EbicsKeysCommon + +# Throwaway passphrase for keys created in a temporary directory. +WRONG_PHRASE = "wrong-passphrase" + + +def capturing_client(captured, init_error=None): + """Stand-in for fintech's EbicsClient that records the real EbicsBank and + EbicsUser built by ebics.xfer._setup_client.""" + + class CapturingClient: + def __init__(self, bank, user, version=None): + if init_error: + raise init_error + captured.update(bank=bank, user=user, version=version) + self.bank = bank + + def FUL(self, filetype, data, **kwargs): + # As fintech does on H003: the OrderID comes from the bank object. + return self.bank._next_order_id(captured["user"].partnerid) + + return CapturingClient + + +@tagged("post_install", "-at_install") +class TestSetupClient(EbicsKeysCommon): + """ebics.xfer._setup_client with real keys; only the transport is faked.""" + + def setUp(self): + super().setUp() + self.userid = self._new_userid() + self._init_1(self.userid) + self.userid.state = "active_keys" + self.ff_ful = self.env.ref("account_ebics.ebics_ff_LCR") + + def _wizard(self, file_format=None, **vals): + return self.env["ebics.xfer"].create( + { + "ebics_config_id": self.ebics_config.id, + "ebics_userid_id": self.userid.id, + "format_id": (file_format or self.ff_ful).id, + "upload_data": base64.b64encode(b"LCR DATA"), + "upload_fname": "lcr.txt", + "note": "", + **vals, + } + ) + + def _setup(self, wizard, init_error=None): + captured = {} + client_class = capturing_client(captured, init_error=init_error) + with patch.object(ebics_xfer_module, "EbicsClient", client_class): + client = wizard._setup_client() + return client, captured + + def test_client_from_config_and_keys(self): + client, captured = self._setup(self._wizard()) + self.assertTrue(client) + self.assertEqual(captured["version"], "H004") + self.assertEqual(captured["bank"].hostid, "TESTHOST") + self.assertEqual(captured["bank"].url, "https://ebics.example.invalid/ebics") + self.assertEqual(captured["user"].partnerid, "PARTNER1") + self.assertEqual(captured["user"].userid, self.userid.name) + + def test_signature_class(self): + cases = [ + # (userid default, file format override, expected transport_only) + ("T", False, True), + ("E", False, False), + ("T", "E", False), + ("E", "T", True), + ] + for user_class, format_class, expected in cases: + with self.subTest(user=user_class, file_format=format_class): + self.userid.signature_class = user_class + self.ff_ful.signature_class = format_class + _client, captured = self._setup(self._wizard()) + self.assertEqual(captured["user"].transport_only, expected) + + def test_h003_order_number_is_given_to_the_bank(self): + self.ebics_config.write({"ebics_version": "H003", "order_number": "B00Z"}) + wizard = self._wizard() + captured = {} + with patch.object(ebics_xfer_module, "EbicsClient", capturing_client(captured)): + ebics_file = wizard._ebics_upload() + self.assertEqual(ebics_file.ebics_order_number, "B00Z") + self.assertEqual(self.ebics_config.order_number, "B010") + + def test_wrong_passphrase(self): + wizard = self._wizard(ebics_passphrase=WRONG_PHRASE) + with self.assertRaisesRegex(UserError, "Error while accessing the EBICS Keys"): + self._setup(wizard) + + def test_missing_keys_directory(self): + self.ebics_config.ebics_keys = "/nonexistent/ebics_keys" + with self.assertRaisesRegex(UserError, "is not available"): + self._setup(self._wizard()) + + def test_client_creation_error(self): + wizard = self._wizard() + client, _captured = self._setup(wizard, init_error=RuntimeError("bad url")) + self.assertFalse(client) + self.assertIn("Unknown Error", wizard.note) + self.assertIn("bad url", wizard.note) diff --git a/account_ebics_batch/__manifest__.py b/account_ebics_batch/__manifest__.py index de8dbf3..4e290be 100644 --- a/account_ebics_batch/__manifest__.py +++ b/account_ebics_batch/__manifest__.py @@ -3,7 +3,7 @@ { "name": "EBICS - Scheduled File Import", - "version": "18.0.1.0.2", + "version": "18.0.1.0.3", "license": "AGPL-3", "author": "Noviat", "website": "https://www.noviat.com/", diff --git a/account_ebics_batch/tests/__init__.py b/account_ebics_batch/tests/__init__.py new file mode 100644 index 0000000..1b196b9 --- /dev/null +++ b/account_ebics_batch/tests/__init__.py @@ -0,0 +1 @@ +from . import test_ebics_batch_import diff --git a/account_ebics_batch/tests/test_ebics_batch_import.py b/account_ebics_batch/tests/test_ebics_batch_import.py new file mode 100644 index 0000000..acb0613 --- /dev/null +++ b/account_ebics_batch/tests/test_ebics_batch_import.py @@ -0,0 +1,95 @@ +# Copyright 2026 Noviat. +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from unittest.mock import patch + +from fintech.ebics import EbicsTechnicalError + +from odoo.exceptions import UserError +from odoo.tests import tagged + +from odoo.addons.account_ebics.tests.common import ( + EbicsTestCommon, + FakeEbicsClient, + read_sample, +) + + +@tagged("post_install", "-at_install") +class TestEbicsBatchImport(EbicsTestCommon): + @classmethod + def setUpClass(cls): + super().setUpClass() + # A format without processing method: files are stored as done. + cls.ff_ptk = cls.env["ebics.file.format"].create( + {"name": "PTK", "type": "down", "order_type": "PTK", "suffix": "txt"} + ) + cls.ebics_config.ebics_file_format_ids = cls.ff_ptk + cls.log_model = cls.env["ebics.batch.log"] + + def _run(self, client, **kwargs): + with self._fake_client(client): + self.log_model._batch_import( + ebics_config_ids=self.ebics_config.ids, **kwargs + ) + return self.log_model.search([], order="id desc", limit=1) + + def test_import(self): + client = FakeEbicsClient(downloads={"PTK": read_sample("ptk_protocol.txt")}) + log = self._run(client, date_from="2026-10-12", date_to="2026-10-13") + self.assertEqual(log.state, "done") + self.assertEqual(log.ebics_config_ids, self.ebics_config) + self.assertEqual(log.file_count, 1) + self.assertEqual(log.file_ids.name, "TESTHOST_PARTNER1_2026-10-13.txt") + self.assertEqual(log.log_ids.state, "done") + self.assertEqual(log.log_ids.error_count, 0) + + def test_import_prefers_transport_signature_user(self): + """Downloads need no signature right: a class T user is preferred.""" + self.ebics_userid.signature_class = "E" + transport_userid = self.ebics_userid.copy( + {"name": "USER2", "signature_class": "T", "state": "active_keys"} + ) + client = FakeEbicsClient(downloads={"PTK": read_sample("ptk_protocol.txt")}) + log = self._run(client, date_to="2026-10-13") + self.assertEqual(log.file_ids.ebics_userid_id, transport_userid) + + def test_import_transfer_error(self): + error = EbicsTechnicalError("061001", "EBICS_AUTHENTICATION_FAILED") + log = self._run(FakeEbicsClient(error=error)) + self.assertEqual(log.state, "error") + self.assertFalse(log.file_ids) + self.assertEqual(log.log_ids.error_count, 1) + self.assertIn("EBICS_AUTHENTICATION_FAILED", log.log_ids.note) + + def test_import_draft_config(self): + self.ebics_config.set_to_draft() + log = self._run(FakeEbicsClient()) + self.assertEqual(log.state, "error") + self.assertIn("Please set state to 'Confirm'", log.log_ids.note) + + def test_import_without_stored_passphrase(self): + self.ebics_userid.ebics_passphrase_store = False + log = self._run(FakeEbicsClient()) + self.assertEqual(log.state, "error") + self.assertIn("No EBICS UserID with stored passphrase", log.log_ids.note) + + def test_draft_files_are_processed_and_reprocessed(self): + ebics_file = self._create_ebics_file("camt053_sparkasse.xml", self.ff_camt053) + log = self.log_model.create({"file_ids": [(6, 0, ebics_file.ids)]}) + self.assertTrue(log.has_draft_files) + file_class = type(ebics_file) + with patch.object(file_class, "process", autospec=True) as process: + log.reprocess() + process.assert_called_once_with(ebics_file) + # the file is still draft since processing was mocked + self.assertEqual(log.state, "draft") + + def test_unlink_only_draft_logs(self): + log = self.log_model.create({}) + log.button_done() + with self.assertRaises(UserError): + log.unlink() + log.button_draft() + log.unlink() + self.assertFalse(log.exists()) diff --git a/account_ebics_batch_payment/__manifest__.py b/account_ebics_batch_payment/__manifest__.py index ba704c6..4b56b86 100644 --- a/account_ebics_batch_payment/__manifest__.py +++ b/account_ebics_batch_payment/__manifest__.py @@ -4,7 +4,7 @@ { "name": "EBICS - Batch Payments (Odoo Enterprise)", "summary": "Send an Odoo Enterprise batch payment to the bank over EBICS", - "version": "18.0.1.3.0", + "version": "18.0.1.3.1", "license": "LGPL-3", "author": "Noviat", "website": "https://www.noviat.com/", diff --git a/account_ebics_batch_payment/tests/__init__.py b/account_ebics_batch_payment/tests/__init__.py new file mode 100644 index 0000000..2684399 --- /dev/null +++ b/account_ebics_batch_payment/tests/__init__.py @@ -0,0 +1 @@ +from . import test_batch_payment_upload diff --git a/account_ebics_batch_payment/tests/test_batch_payment_upload.py b/account_ebics_batch_payment/tests/test_batch_payment_upload.py new file mode 100644 index 0000000..87cbd6d --- /dev/null +++ b/account_ebics_batch_payment/tests/test_batch_payment_upload.py @@ -0,0 +1,77 @@ +# Copyright 2026 Noviat. +# License LGPL-3 or later (https://www.gnu.org/licenses/lgpl). + +import base64 +from unittest.mock import patch + +from odoo.exceptions import UserError +from odoo.tests import tagged + +from odoo.addons.account_ebics.tests.common import EbicsTestCommon, FakeEbicsClient + + +@tagged("post_install", "-at_install") +class TestBatchPaymentUpload(EbicsTestCommon): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.journal = cls._create_bank_journal("TBP", "FR7630004000031234567890143") + cls.ff_cct = cls.env.ref("account_ebics.ebics_ff_CCT") + cls.method = cls.env.ref("account.account_payment_method_manual_out") + + def _batch(self, state="sent"): + batch = self.env["account.batch.payment"].create( + { + "journal_id": self.journal.id, + "batch_type": "outbound", + "payment_method_id": self.method.id, + "export_file": base64.b64encode(b"pain.001"), + "export_filename": "batch.xml", + } + ) + # Without payments the batch stays in draft: set the state directly. + batch.state = state + return batch + + def _generating_files(self): + batch_class = type(self.env["account.batch.payment"]) + return patch.object( + batch_class, "_get_methods_generating_files", return_value=["manual"] + ) + + def test_hide_ebics_upload(self): + with self._generating_files(): + self.assertFalse(self._batch().hide_ebics_upload) + self.assertTrue(self._batch(state="draft").hide_ebics_upload) + batch = self._batch() + batch.ebics_file_id = self.env["ebics.file"].create( + {"name": "batch.xml", "date": "2026-10-13", "pain_state": "uploaded"} + ) + self.assertTrue(batch.hide_ebics_upload) + # no file generation for this payment method + self.assertTrue(self._batch().hide_ebics_upload) + + def test_upload_requires_ebics_config(self): + self.ebics_config.journal_ids = False + with self.assertRaises(UserError): + self._batch().ebics_upload() + + def test_upload_format_from_payment_method(self): + self.method.ebics_file_format_id = self.ff_cct + action = self._batch().ebics_upload() + wizard = self.env["ebics.xfer"].browse(action["res_id"]) + self.assertEqual(wizard.format_id, self.ff_cct) + self.assertEqual(wizard.upload_fname, "batch.xml") + + def test_upload(self): + self.method.ebics_file_format_id = self.ff_cct + batch = self._batch() + action = batch.ebics_upload() + wizard = self.env["ebics.xfer"].browse(action["res_id"]) + with self._fake_client(FakeEbicsClient(order_id="N088")) as client: + wizard.with_context(**action["context"]).ebics_upload() + self.assertEqual(client.uploads[0][1], b"pain.001") + self.assertEqual(batch.ebics_order_number, "N088") + self.assertEqual(batch.ebics_pain_state, "uploaded") + self.assertIn(f"Batch Payment: {batch.name}", batch.ebics_file_id.note) + self.assertTrue(any("N088" in msg.body for msg in batch.message_ids)) diff --git a/account_ebics_oe_statement_import_test/README.rst b/account_ebics_oe_statement_import_test/README.rst new file mode 100644 index 0000000..fc3d5a2 --- /dev/null +++ b/account_ebics_oe_statement_import_test/README.rst @@ -0,0 +1,15 @@ +========================================= +EBICS - Enterprise Statement Import Tests +========================================= + +**Test-only module. Do not install it on a production database.** + +It carries no code and no data. It exists so that continuous integration +installs the Odoo Enterprise CAMT parser (``account_bank_statement_import_camt``) +next to ``account_ebics`` and runs the statement import tests through the +Enterprise import. It is excluded from the Community test job. + +Credits +======= + +Developed and maintained by `Noviat `_. diff --git a/account_ebics_oe_statement_import_test/__init__.py b/account_ebics_oe_statement_import_test/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/account_ebics_oe_statement_import_test/__manifest__.py b/account_ebics_oe_statement_import_test/__manifest__.py new file mode 100644 index 0000000..e907c00 --- /dev/null +++ b/account_ebics_oe_statement_import_test/__manifest__.py @@ -0,0 +1,17 @@ +# Copyright 2026 Noviat. +# License LGPL-3 or later (https://www.gnu.org/licenses/lgpl). + +{ + "name": "EBICS - Enterprise Statement Import Tests", + "summary": "Test-only module, do not install: runs the EBICS statement " + "import tests against the Odoo Enterprise CAMT parser", + "version": "18.0.1.0.0", + "license": "LGPL-3", + "author": "Noviat", + "website": "https://www.noviat.com/", + "category": "Hidden", + "depends": [ + "account_ebics", + "account_bank_statement_import_camt", + ], +} diff --git a/account_ebics_oe_statement_import_test/pyproject.toml b/account_ebics_oe_statement_import_test/pyproject.toml new file mode 100644 index 0000000..4231d0c --- /dev/null +++ b/account_ebics_oe_statement_import_test/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/account_ebics_oe_statement_import_test/static/description/icon.png b/account_ebics_oe_statement_import_test/static/description/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..a2bfe0319365384abfabc65e1a9e784e9842ce74 GIT binary patch literal 19480 zcmV+zOy{$SP)JXVkmn~2Lb8_h%|LifX zOdt)+7k;r2MykpfKFPZJI$(;7;D`WMiuR9~KD1k}TR?VonUbMSRWudA5}Fj9UZ0$c&mKB7o(UhZvL zA}otI14)F$bdrl&$8NX>AaIyQdlwPlvKRggLU1~ndgo>Kd><8ZJy9?Q5C~EVd*W=> zu_q8=Wcx-0xFQHZfFiZ(4S&}LZ8?}B28=>*I*A>++Y@e$RR0h}ZqUoi_SGPyK7Bm7 z_$3gMgc6|ZQEV7cO37?pKU?M(0qaQnj|gx@C_jkodx^K6g}vK!UZF@-W_Z`7NLGp= z<6|Qx0Y_O65dp3s?Oz|+o!Yz%TD22G0n}>%BLWyj#j#r+LOUM${=~TSj8Z}-?++r7hFHGQwlmbkhNBlCB0z))kqUH$yaP-P33X;b6qvK@4-zPVYu^n9 zKtQ~Lok*AJ1t6*k#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ser_only(self): + """Both camt parsers are installed in the Enterprise CI job and + _process_camt053 prefers the OCA one: hide it.""" + file_class = type(self.env["ebics.file"]) + check_import_module = file_class._check_import_module + + def check(record, module, raise_if_not_found=True): + if module == "account_statement_import_camt": + return False + return check_import_module(record, module, raise_if_not_found) + + return patch.object(file_class, "_check_import_module", check) + + def _process(self, sample, name=None): + ebics_file = self._create_ebics_file(sample, self.ff_camt053, name=name) + with self._enterprise_parser_only(): + ebics_file.process() + self.assertEqual(ebics_file.state, "done") + return ebics_file + + def test_camt_statement(self): + journal = self._create_bank_journal("THVB", IBAN_HVB) + ebics_file = self._process("camt053_hvb_clav_fx.xml") + statement = ebics_file.bank_statement_ids + self.assertEqual(statement.journal_id, journal) + self.assertEqual(statement.balance_start, 5000.0) + self.assertEqual(statement.balance_end_real, 3992.5) + self.assertEqual(sorted(statement.line_ids.mapped("amount")), [-857.5, -150.0]) + self.assertEqual(statement.import_format, "camt053") + self.assertIn("1 bank statement has been imported", ebics_file.note_process) + + def test_camt_multi_account(self): + j1 = self._create_bank_journal("TMU1", IBAN_MULTI[0]) + j2 = self._create_bank_journal("TMU2", IBAN_MULTI[1]) + ebics_file = self._process("camt053_multi_account.xml") + self.assertEqual(ebics_file.bank_statement_ids.journal_id, j1 | j2) + self.assertIn("2 bank statements have been imported", ebics_file.note_process) + + def test_reimport_is_reported(self): + self._create_bank_journal("THVB", IBAN_HVB) + sample = "camt053_hvb_clav_fx.xml" + first = self._process(sample, name="first.xml") + self.assertEqual(len(first.bank_statement_ids), 1) + second = self._process(sample, name="second.xml") + self.assertFalse(second.bank_statement_ids) + self.assertIn("has not been processed", second.note_process) + self.assertIn("0010000001", second.note_process) diff --git a/account_ebics_payment_order/__manifest__.py b/account_ebics_payment_order/__manifest__.py index 3c69646..afe6a83 100644 --- a/account_ebics_payment_order/__manifest__.py +++ b/account_ebics_payment_order/__manifest__.py @@ -4,7 +4,7 @@ { "name": "EBICS - Payment Orders (OCA)", "summary": "Send an OCA payment order to the bank over EBICS", - "version": "18.0.1.3.0", + "version": "18.0.1.3.1", "license": "LGPL-3", "author": "Noviat", "website": "https://www.noviat.com/", diff --git a/account_ebics_payment_order/tests/__init__.py b/account_ebics_payment_order/tests/__init__.py new file mode 100644 index 0000000..c99d810 --- /dev/null +++ b/account_ebics_payment_order/tests/__init__.py @@ -0,0 +1 @@ +from . import test_payment_order_upload diff --git a/account_ebics_payment_order/tests/test_payment_order_upload.py b/account_ebics_payment_order/tests/test_payment_order_upload.py new file mode 100644 index 0000000..07b0ca5 --- /dev/null +++ b/account_ebics_payment_order/tests/test_payment_order_upload.py @@ -0,0 +1,95 @@ +# Copyright 2026 Noviat. +# License LGPL-3 or later (https://www.gnu.org/licenses/lgpl). + +import base64 + +from odoo.exceptions import UserError +from odoo.tests import tagged + +from odoo.addons.account_ebics.tests.common import EbicsTestCommon, FakeEbicsClient + + +@tagged("post_install", "-at_install") +class TestPaymentOrderUpload(EbicsTestCommon): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.env.user.groups_id |= cls.env.ref( + "account_payment_order.group_account_payment" + ) + cls.journal = cls._create_bank_journal("TPO", "FR7630004000031234567890143") + cls.ff_cct = cls.env.ref("account_ebics.ebics_ff_CCT") + cls.mode = cls.env["account.payment.mode"].create( + { + "name": "EBICS credit transfer", + "company_id": cls.company.id, + "bank_account_link": "fixed", + "fixed_journal_id": cls.journal.id, + "payment_method_id": cls.env.ref( + "account.account_payment_method_manual_out" + ).id, + "ebics_format_id": cls.ff_cct.id, + } + ) + + def _order(self, state="generated", with_file=True): + order = self.env["account.payment.order"].create( + { + "payment_type": "outbound", + "payment_mode_id": self.mode.id, + "journal_id": self.journal.id, + } + ) + order.state = state + if with_file: + self._attach(order, "pain001.xml") + return order + + def _attach(self, order, name): + return self.env["ir.attachment"].create( + { + "name": name, + "res_model": order._name, + "res_id": order.id, + "datas": base64.b64encode(b"pain.001"), + } + ) + + def test_hide_ebics_upload(self): + self.assertTrue(self._order(state="draft").hide_ebics_upload) + self.assertFalse(self._order().hide_ebics_upload) + self.ebics_config.journal_ids = False + self.assertTrue(self._order().hide_ebics_upload) + + def test_upload_requires_format_on_mode(self): + self.mode.ebics_format_id = False + with self.assertRaisesRegex(UserError, "EBICS File Format"): + self._order().ebics_upload() + + def test_upload_requires_one_file(self): + with self.assertRaisesRegex(UserError, "doesn't contain attachments"): + self._order(with_file=False).ebics_upload() + order = self._order() + self._attach(order, "pain001_old.xml") + with self.assertRaisesRegex(UserError, "multiple attachments"): + order.ebics_upload() + + def test_upload(self): + order = self._order() + # the form button passes the active model, as the web client does + action = order.with_context( + active_model=order._name, active_id=order.id + ).ebics_upload() + wizard = self.env["ebics.xfer"].browse(action["res_id"]) + self.assertEqual(wizard.ebics_config_id, self.ebics_config) + self.assertEqual(wizard.ebics_userid_id, self.ebics_userid) + self.assertEqual(wizard.format_id, self.ff_cct) + self.assertEqual(wizard.upload_fname, "pain001.xml") + with self._fake_client(FakeEbicsClient(order_id="N077")) as client: + wizard.with_context(**action["context"]).ebics_upload() + self.assertEqual(client.uploads[0][1], b"pain.001") + self.assertEqual(order.state, "uploaded") + self.assertEqual(order.ebics_order_number, "N077") + self.assertEqual(order.ebics_file_id.pain_state, "uploaded") + self.assertIn(f"Payment Order: {order.name}", order.ebics_file_id.note) + self.assertTrue(any("N077" in msg.body for msg in order.message_ids)) diff --git a/account_ebics_statement_import_test/README.rst b/account_ebics_statement_import_test/README.rst new file mode 100644 index 0000000..b370d2c --- /dev/null +++ b/account_ebics_statement_import_test/README.rst @@ -0,0 +1,16 @@ +============================== +EBICS - Statement Import Tests +============================== + +**Test-only module. Do not install it on a production database.** + +It carries no code and no data. It exists so that continuous integration +installs the OCA statement parsers (``account_statement_import_camt`` and +``account_statement_import_fr_cfonb``) next to ``account_ebics`` and runs the +end-to-end statement import tests: EBICS download, split per account, bank +statement creation. + +Credits +======= + +Developed and maintained by `Noviat `_. diff --git a/account_ebics_statement_import_test/__init__.py b/account_ebics_statement_import_test/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/account_ebics_statement_import_test/__manifest__.py b/account_ebics_statement_import_test/__manifest__.py new file mode 100644 index 0000000..5c5c447 --- /dev/null +++ b/account_ebics_statement_import_test/__manifest__.py @@ -0,0 +1,18 @@ +# Copyright 2026 Noviat. +# License LGPL-3 or later (https://www.gnu.org/licenses/lgpl). + +{ + "name": "EBICS - Statement Import Tests", + "summary": "Test-only module, do not install: runs the EBICS statement " + "import tests against the OCA CAMT and CFONB parsers", + "version": "18.0.1.0.0", + "license": "LGPL-3", + "author": "Noviat", + "website": "https://www.noviat.com/", + "category": "Hidden", + "depends": [ + "account_ebics_oca_statement_import", + "account_statement_import_camt", + "account_statement_import_fr_cfonb", + ], +} diff --git a/account_ebics_statement_import_test/pyproject.toml b/account_ebics_statement_import_test/pyproject.toml new file mode 100644 index 0000000..4231d0c --- /dev/null +++ b/account_ebics_statement_import_test/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/account_ebics_statement_import_test/static/description/icon.png b/account_ebics_statement_import_test/static/description/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..a2bfe0319365384abfabc65e1a9e784e9842ce74 GIT binary patch literal 19480 zcmV+zOy{$SP)JXVkmn~2Lb8_h%|LifX zOdt)+7k;r2MykpfKFPZJI$(;7;D`WMiuR9~KD1k}TR?VonUbMSRWudA5}Fj9UZ0$c&mKB7o(UhZvL zA}otI14)F$bdrl&$8NX>AaIyQdlwPlvKRggLU1~ndgo>Kd><8ZJy9?Q5C~EVd*W=> zu_q8=Wcx-0xFQHZfFiZ(4S&}LZ8?}B28=>*I*A>++Y@e$RR0h}ZqUoi_SGPyK7Bm7 z_$3gMgc6|ZQEV7cO37?pKU?M(0qaQnj|gx@C_jkodx^K6g}vK!UZF@-W_Z`7NLGp= z<6|Qx0Y_O65dp3s?Oz|+o!Yz%TD22G0n}>%BLWyj#j#r+LOUM${=~TSj8Z}-?++r7hFHGQwlmbkhNBlCB0z))kqUH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FsK!ga{D split per account -> OCA parser -> statements. + + These assertions hold whether or not the account_ebics_oca_statement_import + glue is installed (it does not exist on 19.0).""" + + def _process(self, sample, file_format, name=None): + ebics_file = self._create_ebics_file(sample, file_format, name=name) + ebics_file.process() + self.assertEqual(ebics_file.state, "done") + return ebics_file + + def test_cfonb_multi_account(self): + j1 = self._create_bank_journal("TCA1", IBAN_CA833[0]) + j3 = self._create_bank_journal("TCA3", IBAN_CA833[2]) + ebics_file = self._process("cfonb120_lf_multi_account_05.dat", self.ff_cfonb120) + statements = ebics_file.bank_statement_ids.sorted("journal_id") + self.assertEqual(statements.journal_id, j1 | j3) + st1 = statements.filtered(lambda s: s.journal_id == j1) + self.assertEqual(st1.balance_start, 8400.0) + self.assertAlmostEqual(st1.balance_end_real, 8907.45) + self.assertEqual(sorted(st1.line_ids.mapped("amount")), [-132.55, 640.0]) + self.assertIn("FACT 99812", " ".join(st1.line_ids.mapped("payment_ref"))) + self.assertEqual(set(statements.mapped("import_format")), {"cfonb120"}) + self.assertIn("2 bank statements have been imported", ebics_file.note_process) + + def test_cfonb_minimal_without_complement_lines(self): + journal = self._create_bank_journal("TCA9", IBAN_CA879[3]) + ebics_file = self._process("cfonb120_lf_minimal_no_05.dat", self.ff_cfonb120) + statement = ebics_file.bank_statement_ids + self.assertEqual(statement.journal_id, journal) + self.assertEqual(len(statement.line_ids), 2) + self.assertEqual(statement.balance_end_real, 5290.0) + + def test_cfonb_no_line_terminator(self): + journals = [ + self._create_bank_journal(f"TLC{i}", iban) + for i, iban in enumerate(IBAN_LCL) + ] + ebics_file = self._process( + "cfonb120_no_eol_multi_account_mixed.dat", self.ff_cfonb120 + ) + self.assertEqual( + ebics_file.bank_statement_ids.journal_id, journals[1] | journals[3] + ) + + def test_cfonb_complement_lines_in_label(self): + self._create_bank_journal("TCIC", IBAN_CIC) + ebics_file = self._process("cfonb120_lf_rich_05.dat", self.ff_cfonb120) + refs = " ".join(ebics_file.bank_statement_ids.line_ids.mapped("payment_ref")) + self.assertIn("FACTURE 7731", refs) + self.assertIn("SALE", refs) + + def test_cfonb_missing_journal_is_reported(self): + self._create_bank_journal("TCA1", IBAN_CA833[0]) + ebics_file = self._process("cfonb120_lf_multi_account_05.dat", self.ff_cfonb120) + self.assertEqual(len(ebics_file.bank_statement_ids), 1) + self.assertIn("No financial journal found", ebics_file.note_process) + self.assertIn("20000000203", ebics_file.note_process) + + def test_cfonb_empty_file(self): + self._create_bank_journal("TCMB", IBAN_CMB) + ebics_file = self._process("cfonb120_no_eol_empty_only.dat", self.ff_cfonb120) + self.assertFalse(ebics_file.bank_statement_ids) + self.assertIn("doesn't contain any transaction", ebics_file.note_process) + + def test_camt_fx_entry(self): + journal = self._create_bank_journal("THVB", IBAN_HVB) + ebics_file = self._process("camt053_hvb_clav_fx.xml", self.ff_camt053) + statement = ebics_file.bank_statement_ids + self.assertEqual(statement.journal_id, journal) + self.assertEqual(statement.balance_start, 5000.0) + self.assertEqual(statement.balance_end_real, 3992.5) + self.assertEqual(sorted(statement.line_ids.mapped("amount")), [-857.5, -150.0]) + self.assertEqual(statement.import_format, "camt053") + + def test_camt_multi_account(self): + j1 = self._create_bank_journal("TMU1", IBAN_MULTI[0]) + j2 = self._create_bank_journal("TMU2", IBAN_MULTI[1]) + ebics_file = self._process("camt053_multi_account.xml", self.ff_camt053) + self.assertEqual(ebics_file.bank_statement_ids.journal_id, j1 | j2) + + def test_download_then_process(self): + journal = self._create_bank_journal("TCMB", IBAN_CMB) + data = read_sample("cfonb120_no_eol_single_account.dat") + wizard = self._download_wizard(self.ff_cfonb120, date_to=date(2026, 10, 13)) + with self._fake_client(FakeEbicsClient(downloads={"FDL": data})): + action = wizard.ebics_download() + ebics_file = self.env["ebics.file"].browse(action["context"]["ebics_file_ids"]) + ebics_file.process() + self.assertEqual(ebics_file.bank_statement_ids.journal_id, journal) + self.assertEqual(len(ebics_file.bank_statement_ids.line_ids), 2) + self.assertEqual( + ebics_file.bank_statement_ids.ebics_file_id, + ebics_file, + ) + + +@tagged("post_install", "-at_install") +class TestStatementImportOcaGlue(EbicsTestCommon): + """Behaviour added by account_ebics_oca_statement_import (18.0 only). + + Drop this class when forward-porting to a version without that module.""" + + def test_reimport_is_reported(self): + self._create_bank_journal("TCMB", IBAN_CMB) + sample = "cfonb120_no_eol_single_account.dat" + first = self._create_ebics_file(sample, self.ff_cfonb120, name="first.dat") + first.process() + self.assertEqual(len(first.bank_statement_ids), 1) + second = self._create_ebics_file(sample, self.ff_cfonb120, name="second.dat") + second.process() + self.assertFalse(second.bank_statement_ids) + self.assertIn("has already been imported", second.note_process) + + def test_currency_suffix_on_account(self): + journal = self._create_bank_journal("TSUF", IBAN_SUFFIX) + ebics_file = self._create_ebics_file( + "camt053_currency_suffix.xml", self.ff_camt053 + ) + ebics_file.process() + self.assertEqual(ebics_file.bank_statement_ids.journal_id, journal) diff --git a/test-requirements.txt b/test-requirements.txt index d2fce6c..159fb3b 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,3 +1,5 @@ odoo-addon-module_change_auto_install openupgradelib lxml_html_clean +odoo-addon-account_statement_import_camt +odoo-addon-account_statement_import_fr_cfonb From c574fbe11f5a50e6135667cf3f615b0b2f69ffad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Didderen?= Date: Tue, 27 Oct 2026 23:14:07 +0100 Subject: [PATCH 13/17] [FIX] account_ebics - Number duplicate upload file names before the extension A duplicate upload name got the counter appended to the previous candidate and after the extension: pay.xml_1, then pay.xml_1_2, pay.xml_1_2_3. Keep the extension and number from the original name: pay_1.xml, pay_2.xml. --- account_ebics/tests/test_ebics_xfer.py | 14 ++++++++++---- account_ebics/wizards/ebics_xfer.py | 7 +++++-- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/account_ebics/tests/test_ebics_xfer.py b/account_ebics/tests/test_ebics_xfer.py index f27b561..2dd0e09 100644 --- a/account_ebics/tests/test_ebics_xfer.py +++ b/account_ebics/tests/test_ebics_xfer.py @@ -190,14 +190,20 @@ class TestEbicsXferUpload(EbicsTestCommon): self.assertFalse(self.ebics_config.order_number) def test_upload_same_name_twice(self): + """The counter goes before the extension and does not stack up.""" names = [] - for _i in range(3): + for _i in range(4): wizard = self._upload_wizard(self.ff_btu) with self._fake_client(FakeEbicsClient()): names.append(wizard._ebics_upload().name) - # Pinned, probably unintended: _update_ef_vals appends each counter to - # the previous candidate (pay.xml_1_2) instead of pay.xml_2. - self.assertEqual(names, ["pay.xml", "pay.xml_1", "pay.xml_1_2"]) + self.assertEqual(names, ["pay.xml", "pay_1.xml", "pay_2.xml", "pay_3.xml"]) + # without extension + wizard = self._upload_wizard(self.ff_btu, fname="pay") + with self._fake_client(FakeEbicsClient()): + self.assertEqual(wizard._ebics_upload().name, "pay") + wizard = self._upload_wizard(self.ff_btu, fname="pay") + with self._fake_client(FakeEbicsClient()): + self.assertEqual(wizard._ebics_upload().name, "pay_1") def test_upload_ful_h003_order_number(self): self.ebics_config.write({"ebics_version": "H003", "order_number": "A00Z"}) diff --git a/account_ebics/wizards/ebics_xfer.py b/account_ebics/wizards/ebics_xfer.py index 8801730..f19c9ea 100644 --- a/account_ebics/wizards/ebics_xfer.py +++ b/account_ebics/wizards/ebics_xfer.py @@ -3,6 +3,7 @@ import base64 import logging +import os from sys import exc_info from traceback import format_exception @@ -578,11 +579,13 @@ class EbicsXfer(models.TransientModel): fn = ef_vals["name"] dups = self._check_duplicate_ebics_file(fn, self.format_id) if dups: + # pay.xml -> pay_1.xml, pay_2.xml, ... + base, ext = os.path.splitext(fn) n = 1 - fn = "_".join([fn, str(n)]) + fn = f"{base}_{n}{ext}" while self._check_duplicate_ebics_file(fn, self.format_id): n += 1 - fn = "_".join([fn, str(n)]) + fn = f"{base}_{n}{ext}" ef_vals["name"] = fn def _handle_download_data(self, data, file_format): From 7a3a8e6ceb24a192c55487fd5325cb0d11f54088 Mon Sep 17 00:00:00 2001 From: noviat-ci-bot Date: Sun, 8 Nov 2026 22:46:24 +0000 Subject: [PATCH 14/17] update addons table --- README.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 853b857..9efc6e2 100644 --- a/README.md +++ b/README.md @@ -14,12 +14,14 @@ Available addons ---------------- addon | version | maintainers | summary --- | --- | --- | --- -[account_ebics](account_ebics/) | 18.0.1.3.0 | | Download bank statements and upload payment files directly from Odoo, using the European EBICS standard -[account_ebics_batch](account_ebics_batch/) | 18.0.1.0.2 | | Download and process your EBICS files automatically, on a schedule -[account_ebics_batch_payment](account_ebics_batch_payment/) | 18.0.1.3.0 | | Send an Odoo Enterprise batch payment to the bank over EBICS -[account_ebics_oca_statement_import](account_ebics_oca_statement_import/) | 18.0.1.0.2 | | Process EBICS statement files with the OCA bank statement import +[account_ebics](account_ebics/) | 18.0.1.3.1 | | Download bank statements and upload payment files directly from Odoo, using the European EBICS standard +[account_ebics_batch](account_ebics_batch/) | 18.0.1.0.3 | | Download and process your EBICS files automatically, on a schedule +[account_ebics_batch_payment](account_ebics_batch_payment/) | 18.0.1.3.1 | | Send an Odoo Enterprise batch payment to the bank over EBICS +[account_ebics_oca_statement_import](account_ebics_oca_statement_import/) | 18.0.1.0.3 | | Process EBICS statement files with the OCA bank statement import [account_ebics_oe](account_ebics_oe/) | 18.0.1.0.1 | | Place the EBICS menus in the Odoo Enterprise accounting application -[account_ebics_payment_order](account_ebics_payment_order/) | 18.0.1.3.0 | | Send an OCA payment order to the bank over EBICS +[account_ebics_oe_statement_import_test](account_ebics_oe_statement_import_test/) | 18.0.1.0.0 | | Test-only module, do not install: runs the EBICS statement import tests against the Odoo Enterprise CAMT parser +[account_ebics_payment_order](account_ebics_payment_order/) | 18.0.1.3.1 | | Send an OCA payment order to the bank over EBICS +[account_ebics_statement_import_test](account_ebics_statement_import_test/) | 18.0.1.0.0 | | Test-only module, do not install: runs the EBICS statement import tests against the OCA CAMT and CFONB parsers [//]: # (end addons) From e9b24eb02fe1d008af781990a81e4753d362d2f3 Mon Sep 17 00:00:00 2001 From: oca-ci Date: Sun, 8 Nov 2026 22:50:29 +0000 Subject: [PATCH 15/17] [UPD] Update account_ebics.pot --- account_ebics/i18n/account_ebics.pot | 12 ++++++------ account_ebics/i18n/de.po | 15 +++++++++------ account_ebics/i18n/fr.po | 15 +++++++++------ account_ebics/i18n/nl.po | 15 +++++++++------ 4 files changed, 33 insertions(+), 24 deletions(-) diff --git a/account_ebics/i18n/account_ebics.pot b/account_ebics/i18n/account_ebics.pot index 4382dcb..7f6b273 100644 --- a/account_ebics/i18n/account_ebics.pot +++ b/account_ebics/i18n/account_ebics.pot @@ -13,12 +13,6 @@ msgstr "" "Content-Transfer-Encoding: \n" "Plural-Forms: \n" -#. module: account_ebics -#. odoo-python -#: code:addons/account_ebics/models/ebics_file.py:0 -msgid " has" -msgstr "" - #. module: account_ebics #. odoo-python #: code:addons/account_ebics/models/ebics_file.py:0 @@ -539,6 +533,12 @@ msgid "" "(%(order_type)s):" msgstr "" +#. module: account_ebics +#. odoo-python +#: code:addons/account_ebics/wizards/ebics_admin_order.py:0 +msgid "EBICS Functional Error during execution of order %(order_type)s:" +msgstr "" + #. module: account_ebics #. odoo-python #: code:addons/account_ebics/models/ebics_userid.py:0 diff --git a/account_ebics/i18n/de.po b/account_ebics/i18n/de.po index 2c161f7..5b078f6 100644 --- a/account_ebics/i18n/de.po +++ b/account_ebics/i18n/de.po @@ -20,12 +20,6 @@ msgstr "" "Plural-Forms: nplurals=2; plural=n != 1;\n" "X-Generator: Weblate 2026.10.1\n" -#. module: account_ebics -#. odoo-python -#: code:addons/account_ebics/models/ebics_file.py:0 -msgid " has" -msgstr " wurde" - #. module: account_ebics #. odoo-python #: code:addons/account_ebics/models/ebics_file.py:0 @@ -582,6 +576,12 @@ msgstr "" "Funktionaler EBICS-Fehler beim Herunterladen des Dateiformats %(name)s " "(%(order_type)s):" +#. module: account_ebics +#. odoo-python +#: code:addons/account_ebics/wizards/ebics_admin_order.py:0 +msgid "EBICS Functional Error during execution of order %(order_type)s:" +msgstr "" + #. module: account_ebics #. odoo-python #: code:addons/account_ebics/models/ebics_userid.py:0 @@ -1952,6 +1952,9 @@ msgstr "" "urlopen-Fehler:\n" " URL '%(url)s' - %(val)s" +#~ msgid " has" +#~ msgstr " wurde" + #~ msgid "" #~ "EBICS Keys Root Directory %s is not available.\n" #~ "Please contact your system administrator." diff --git a/account_ebics/i18n/fr.po b/account_ebics/i18n/fr.po index e812d77..509c9ae 100644 --- a/account_ebics/i18n/fr.po +++ b/account_ebics/i18n/fr.po @@ -21,12 +21,6 @@ msgstr "" "Plural-Forms: nplurals=2; plural=n > 1;\n" "X-Generator: Weblate 2026.10.1\n" -#. module: account_ebics -#. odoo-python -#: code:addons/account_ebics/models/ebics_file.py:0 -msgid " has" -msgstr " a" - #. module: account_ebics #. odoo-python #: code:addons/account_ebics/models/ebics_file.py:0 @@ -583,6 +577,12 @@ msgstr "" "Erreur fonctionnelle EBICS lors du téléchargement du format de fichier " "%(name)s (%(order_type)s) :" +#. module: account_ebics +#. odoo-python +#: code:addons/account_ebics/wizards/ebics_admin_order.py:0 +msgid "EBICS Functional Error during execution of order %(order_type)s:" +msgstr "" + #. module: account_ebics #. odoo-python #: code:addons/account_ebics/models/ebics_userid.py:0 @@ -1949,6 +1949,9 @@ msgstr "" "erreur urlopen :\n" " url '%(url)s' - %(val)s" +#~ msgid " has" +#~ msgstr " a" + #~ msgid "" #~ "EBICS Keys Root Directory %s is not available.\n" #~ "Please contact your system administrator." diff --git a/account_ebics/i18n/nl.po b/account_ebics/i18n/nl.po index dcfd6f2..6023ecd 100644 --- a/account_ebics/i18n/nl.po +++ b/account_ebics/i18n/nl.po @@ -21,12 +21,6 @@ msgstr "" "Plural-Forms: nplurals=2; plural=n != 1;\n" "X-Generator: Weblate 2026.10.1\n" -#. module: account_ebics -#. odoo-python -#: code:addons/account_ebics/models/ebics_file.py:0 -msgid " has" -msgstr " heeft" - #. module: account_ebics #. odoo-python #: code:addons/account_ebics/models/ebics_file.py:0 @@ -581,6 +575,12 @@ msgstr "" "EBICS functionele fout tijdens het downloaden van bestandsformaat %(name)s " "(%(order_type)s):" +#. module: account_ebics +#. odoo-python +#: code:addons/account_ebics/wizards/ebics_admin_order.py:0 +msgid "EBICS Functional Error during execution of order %(order_type)s:" +msgstr "" + #. module: account_ebics #. odoo-python #: code:addons/account_ebics/models/ebics_userid.py:0 @@ -1942,6 +1942,9 @@ msgstr "" "urlopen-fout:\n" " url '%(url)s' - %(val)s" +#~ msgid " has" +#~ msgstr " heeft" + #~ msgid "" #~ "EBICS Keys Root Directory %s is not available.\n" #~ "Please contact your system administrator." From b4dafdefb1c8cdf892712c593410ef9a2cb14ad6 Mon Sep 17 00:00:00 2001 From: oca-ci Date: Sun, 8 Nov 2026 22:50:33 +0000 Subject: [PATCH 16/17] [UPD] Update account_ebics_oe_statement_import_test.pot --- .../i18n/account_ebics_oe_statement_import_test.pot | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 account_ebics_oe_statement_import_test/i18n/account_ebics_oe_statement_import_test.pot diff --git a/account_ebics_oe_statement_import_test/i18n/account_ebics_oe_statement_import_test.pot b/account_ebics_oe_statement_import_test/i18n/account_ebics_oe_statement_import_test.pot new file mode 100644 index 0000000..3eb73ed --- /dev/null +++ b/account_ebics_oe_statement_import_test/i18n/account_ebics_oe_statement_import_test.pot @@ -0,0 +1,13 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 18.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" From 95f75a4fff28ce22b0cce6e6daa11767a2801921 Mon Sep 17 00:00:00 2001 From: oca-ci Date: Sun, 8 Nov 2026 22:50:34 +0000 Subject: [PATCH 17/17] [UPD] Update account_ebics_statement_import_test.pot --- .../i18n/account_ebics_statement_import_test.pot | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 account_ebics_statement_import_test/i18n/account_ebics_statement_import_test.pot diff --git a/account_ebics_statement_import_test/i18n/account_ebics_statement_import_test.pot b/account_ebics_statement_import_test/i18n/account_ebics_statement_import_test.pot new file mode 100644 index 0000000..3eb73ed --- /dev/null +++ b/account_ebics_statement_import_test/i18n/account_ebics_statement_import_test.pot @@ -0,0 +1,13 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 18.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"