mirror of
https://github.com/brain-tec/account_ebics.git
synced 2026-12-01 14:01:15 +00:00
[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.
This commit is contained in:
1 parent
c43166e272
commit
1df4a1eb3b
1 file changed
+6
-1
@@ -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"
|
||||
|
||||
Reference in new issue
Block a user