remove logging, add config-settings for caching, add docs

This commit is contained in:
Frederik Jaeckel 2023-03-05 10:20:02 +01:00
parent 03324d5944
commit 78f160bf0b
6 changed files with 47 additions and 96 deletions

25
line.py
View file

@ -16,7 +16,6 @@ from sql.functions import DatePart
from sql.conditionals import Case
from .book import sel_state_book
from .mixin import SecondCurrencyMixin, MemCacheIndexMx
from .model import CACHEKEY_CASHBOOK
sel_payee = [
@ -180,8 +179,6 @@ class Line(SecondCurrencyMixin, MemCacheIndexMx, Workflow, ModelSQL, ModelView):
states={'invisible': True}, model_name='res.user'),
'on_change_with_owner_cashbook')
#image = fields.Binary...
@classmethod
def __register__(cls, module_name):
super(Line, cls).__register__(module_name)
@ -984,8 +981,6 @@ class Line(SecondCurrencyMixin, MemCacheIndexMx, Workflow, ModelSQL, ModelView):
def create(cls, vlist):
""" add debit/credit
"""
MemCache = Pool().get('cashbook.memcache')
vlist = [x.copy() for x in vlist]
for values in vlist:
values.update(cls.add_values_from_splitlines(values))
@ -1006,20 +1001,13 @@ class Line(SecondCurrencyMixin, MemCacheIndexMx, Workflow, ModelSQL, ModelView):
'descr': values.get('description', '-'),
},
))
records = super(Line, cls).create(vlist)
# ~ for record in records:
# ~ for x in record.cashbook.get_cachekeys_by_hierarchy():
# ~ MemCache.record_update(x, record)
return records
return super(Line, cls).create(vlist)
@classmethod
def write(cls, *args):
""" deny update if cashbook.line!='open',
add or update debit/credit
"""
MemCache = Pool().get('cashbook.memcache')
actions = iter(args)
to_write = []
for lines, values in zip(actions, actions):
@ -1066,22 +1054,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)
@classmethod
def delete(cls, lines):
""" deny delete if book is not 'open' or wf is not 'edit'
"""
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)
super(Line, cls).delete(lines)
# end Line