details:   https://code.tryton.org/tryton/commit/4fac5bd42fb5
branch:    default
user:      Nicolas Évrard <[email protected]>
date:      Tue Sep 22 17:39:01 2026 +0200
description:
        Remove local cache cleaning after increasing the Transaction's counter

        As the Transaction counter is increased, the next time we will make a 
getattr
        on a record a call to refresh the local cache will be made. It renders 
this
        cleaning useless.

        Closes #15119
diffstat:

 modules/party_relationship/party.py   |  3 ---
 trytond/trytond/ir/sequence.py        |  1 -
 trytond/trytond/model/modelstorage.py |  8 --------
 3 files changed, 0 insertions(+), 12 deletions(-)

diffs (49 lines):

diff -r 57681954c526 -r 4fac5bd42fb5 modules/party_relationship/party.py
--- a/modules/party_relationship/party.py       Mon Sep 28 14:36:21 2026 +0200
+++ b/modules/party_relationship/party.py       Tue Sep 22 17:39:01 2026 +0200
@@ -209,9 +209,6 @@
             cls._before_write(*args))
 
         relations = cls.browse(ids)
-        # Clean local cache of reverse
-        for relation in relations:
-            relation._local_cache.pop(relation.reverse_id, None)
         # Clean cursor cache of reverse
         for cache in Transaction().cache.values():
             if cls.__name__ in cache:
diff -r 57681954c526 -r 4fac5bd42fb5 trytond/trytond/ir/sequence.py
--- a/trytond/trytond/ir/sequence.py    Mon Sep 28 14:36:21 2026 +0200
+++ b/trytond/trytond/ir/sequence.py    Tue Sep 22 17:39:01 2026 +0200
@@ -377,7 +377,6 @@
                     transaction.connection, self._sql_sequence_name, n)
                 # clean cache
                 transaction.counter += 1
-                self._local_cache.pop(self.id, None)
             else:
                 # pre-fetch number_next
                 start = self.number_next_internal
diff -r 57681954c526 -r 4fac5bd42fb5 trytond/trytond/model/modelstorage.py
--- a/trytond/trytond/model/modelstorage.py     Mon Sep 28 14:36:21 2026 +0200
+++ b/trytond/trytond/model/modelstorage.py     Tue Sep 22 17:39:01 2026 +0200
@@ -425,10 +425,6 @@
         # Increase transaction counter
         transaction.counter += 1
 
-        # Clean local cache
-        for record in all_records:
-            record._local_cache.pop(record.id, None)
-
         # Clean transaction cache
         for cache in transaction.cache.values():
             if cls.__name__ in cache:
@@ -508,10 +504,6 @@
         # Increase transaction counter
         transaction.counter += 1
 
-        # Clean local cache
-        for record in records:
-            record._local_cache.pop(record.id, None)
-
         # Clean transaction cache
         for cache in transaction.cache.values():
             if cls.__name__ in cache:

Reply via email to