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

View file

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