Cédric Krier pushed to branch branch/default at Tryton / Tryton


Commits:
3a277da4 by Cédric Krier at 2023-02-20T23:03:59+01:00
Reset cache when restore history of ModelSQL

Closes #5086
- - - - -
cbbbe9db by Cédric Krier at 2023-02-20T23:06:20+01:00
Document that no triggers are called with restore history
- - - - -


2 changed files:

- trytond/doc/ref/models.rst
- trytond/trytond/model/modelsql.py


Changes:

=====================================
trytond/doc/ref/models.rst
=====================================
@@ -583,7 +583,8 @@
    Restoring a record still generates an entry in the history table.
 
    .. warning::
-      No access rights are verified and the records are not validated.
+      No access rights are verified, the restored records are not validated and
+      no triggers are called.
 
 .. classmethod:: ModelSQL.restore_history_before(ids, datetime)
 
@@ -592,7 +593,8 @@
    Restoring a record still generates an entry in the history table.
 
    .. warning::
-      No access rights are verified and the records are not validated.
+      No access rights are verified, the restored records are not validated and
+      not triggers are called.
 
 .. classmethod:: ModelSQL.search(domain[, offset[, limit[, order[, count[, 
query]]]]])
 


=====================================
trytond/trytond/model/modelsql.py
=====================================
@@ -643,6 +643,14 @@
         cursor = transaction.connection.cursor()
         table = cls.__table__()
         history = cls.__table_history__()
+
+        transaction.counter += 1
+        for cache in transaction.cache.values():
+            if cls.__name__ in cache:
+                cache_cls = cache[cls.__name__]
+                for id_ in ids:
+                    cache_cls.pop(id_, None)
+
         columns = []
         hcolumns = []
         fnames = sorted(n for n, f in cls._fields.items()



View it on Heptapod: 
https://foss.heptapod.net/tryton/tryton/-/compare/852bee55c2522d71c3eade37f0a30ae18f92ab99...cbbbe9dbc2a876d1853d65491831dabc435114a1

-- 
View it on Heptapod: 
https://foss.heptapod.net/tryton/tryton/-/compare/852bee55c2522d71c3eade37f0a30ae18f92ab99...cbbbe9dbc2a876d1853d65491831dabc435114a1
You're receiving this email because of your account on foss.heptapod.net.


Reply via email to