Clear lot cache after SQL UPDATE. #048200

This commit is contained in:
Albert Cervera i Areny 2021-11-22 17:01:20 +01:00
parent 79fa2a439d
commit 8a8bad1e9c
1 changed files with 7 additions and 11 deletions

View File

@ -77,18 +77,14 @@ class Lot(DeactivableMixin, metaclass=PoolMeta):
# Increase transaction counter
Transaction().counter += 1
# Clean local cache
for record in lots:
local_cache = record._local_cache.get(record.id)
if local_cache:
local_cache.clear()
# Clean cursor cache
for cache in Transaction().cache.values():
if cls.__name__ in cache:
for record in lots:
if record.id in cache[cls.__name__]:
cache[cls.__name__][record.id].clear()
for cache in list(Transaction().cache.values()):
for cache in (cache,
list(cache.get('_language_cache', {}).values())):
if cls.__name__ in cache:
cache_cls = cache[cls.__name__]
for record in lots:
cache_cls.pop(record.id, None)
class Move(metaclass=PoolMeta):