Ensure check_warnings and _datamanagers are valid when using them

(grafted from ee9737c3a9c8618d09c491f5c3401fef0f0f078f)

--HG--
branch : 8.0
This commit is contained in:
Nicolas Évrard
2026-04-24 11:47:03 +02:00
parent f40a735a0e
commit c4fdf6d9a0
+5 -3
View File
@@ -368,7 +368,8 @@ class Transaction(object):
self._clear_warnings()
def _clear_warnings(self):
self.check_warnings.clear()
if self.check_warnings:
self.check_warnings.clear()
def commit(self):
from trytond.cache import Cache
@@ -404,8 +405,9 @@ class Transaction(object):
from trytond.cache import Cache
for cache in self.cache.values():
cache.clear()
for datamanager in self._datamanagers:
datamanager.tpc_abort(self)
if self._datamanagers:
for datamanager in self._datamanagers:
datamanager.tpc_abort(self)
Cache.rollback(self)
self._clear_log_records()
self._clear_user_notifications()