details: https://code.tryton.org/tryton/commit/0d2d6bc174ce
branch: 7.0
user: Cédric Krier <[email protected]>
date: Tue Aug 25 09:45:59 2026 +0200
description:
Store only records count greater than 0 in the cache when delete records
The existing cached count may be just an estimation so it is possible
that more
records are deleted.
Closes #15038
(grafted from aa4a8bd85207b307b4aa075b105550e4ddae100f)
diffstat:
trytond/trytond/model/modelstorage.py | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diffs (13 lines):
diff -r aa6b291b30e9 -r 0d2d6bc174ce trytond/trytond/model/modelstorage.py
--- a/trytond/trytond/model/modelstorage.py Fri Aug 14 12:55:53 2026 +0200
+++ b/trytond/trytond/model/modelstorage.py Tue Aug 25 09:45:59 2026 +0200
@@ -353,7 +353,8 @@
if random.random() < 1 / _cache_count_clear:
cls._count_cache.set(cls.__name__, None)
else:
- cls._count_cache.set(cls.__name__, count - len(records))
+ cls._count_cache.set(
+ cls.__name__, max(count - len(records), 0))
@classmethod
@without_check_access