details:   https://code.tryton.org/tryton/commit/ee9737c3a9c8
branch:    default
user:      Nicolas Évrard <[email protected]>
date:      Fri Apr 24 11:47:03 2026 +0200
description:
        Ensure check_warnings and _datamanagers are valid when using them
diffstat:

 trytond/trytond/transaction.py |  8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diffs (25 lines):

diff -r 7ab23e6cc9d3 -r ee9737c3a9c8 trytond/trytond/transaction.py
--- a/trytond/trytond/transaction.py    Fri Apr 24 11:45:37 2026 +0200
+++ b/trytond/trytond/transaction.py    Fri Apr 24 11:47:03 2026 +0200
@@ -369,7 +369,8 @@
         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
@@ -405,8 +406,9 @@
         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()

Reply via email to