mirror of
https://github.com/brain-tec/account_ebics.git
synced 2026-11-06 10:00:39 +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 left the test transaction. Skip the commit when the registry is in test mode or the current thread is a test thread.
This commit is contained in:
1 parent
2753328caa
commit
f44076ff69
1 file changed
+7
-1
@@ -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"
|
||||
|
||||
Reference in new issue
Block a user