From c977675dc4e436afbaabe81bc1de92945b4c8497 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] [FIX] account_ebics - Do not commit during tests in the Enterprise import _process_bank_statement_oe commits after each statement. Under tests this leaves the test transaction (19.0 test cursors even raise on commit). Skip the commit while a test runs, using odoo.modules.module.current_test: Registry.in_test_mode() and the thread "testing" flag no longer exist in 19.0. --- account_ebics/models/ebics_file.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/account_ebics/models/ebics_file.py b/account_ebics/models/ebics_file.py index 80d92c3..d43e2d0 100644 --- a/account_ebics/models/ebics_file.py +++ b/account_ebics/models/ebics_file.py @@ -11,6 +11,7 @@ from lxml import etree from odoo import api, fields, models from odoo.exceptions import UserError +from odoo.modules import module as odoo_module from odoo.addons.base.models.res_bank import sanitize_account_number @@ -504,11 +505,15 @@ 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. """ + # Registry.in_test_mode() and thread.testing are gone in 19.0 + testing = odoo_module.current_test 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"