book/line: logging, model: cache-write skip existing values

This commit is contained in:
Frederik Jaeckel 2023-03-04 21:24:19 +01:00
parent 179543bcf0
commit 03324d5944
4 changed files with 81 additions and 35 deletions

22
line.py
View file

@ -1008,9 +1008,9 @@ class Line(SecondCurrencyMixin, MemCacheIndexMx, Workflow, ModelSQL, ModelView):
))
records = super(Line, cls).create(vlist)
for record in records:
for x in record.cashbook.get_cachekeys_by_hierarchy():
MemCache.record_update(x, record)
# ~ for record in records:
# ~ for x in record.cashbook.get_cachekeys_by_hierarchy():
# ~ MemCache.record_update(x, record)
return records
@classmethod
@ -1066,11 +1066,11 @@ class Line(SecondCurrencyMixin, MemCacheIndexMx, Workflow, ModelSQL, ModelView):
super(Line, cls).write(*to_write)
actions = iter(to_write)
for records, values in zip(actions, actions):
for record in records:
for x in record.cashbook.get_cachekeys_by_hierarchy():
MemCache.record_update(x, record)
# ~ actions = iter(to_write)
# ~ for records, values in zip(actions, actions):
# ~ for record in records:
# ~ for x in record.cashbook.get_cachekeys_by_hierarchy():
# ~ MemCache.record_update(x, record)
@classmethod
def delete(cls, lines):
@ -1079,9 +1079,9 @@ class Line(SecondCurrencyMixin, MemCacheIndexMx, Workflow, ModelSQL, ModelView):
MemCache = Pool().get('cashbook.memcache')
cls.check_permission_delete(lines)
for line in lines:
for x in line.cashbook.get_cachekeys_by_hierarchy():
MemCache.record_update(x, None)
# ~ for line in lines:
# ~ for x in line.cashbook.get_cachekeys_by_hierarchy():
# ~ MemCache.record_update(x, None)
super(Line, cls).delete(lines)
# end Line