speedup: indexes, caching

This commit is contained in:
Frederik Jaeckel 2023-02-26 22:49:21 +01:00
parent 86e6c33cc1
commit 624a5bff55
11 changed files with 352 additions and 32 deletions

View file

@ -15,7 +15,7 @@ from sql import Literal
from sql.functions import DatePart
from sql.conditionals import Case
from .book import sel_state_book
from .mixin import SecondCurrencyMixin
from .mixin import SecondCurrencyMixin, MemCacheIndexMx
sel_payee = [
@ -48,7 +48,7 @@ STATES = {
DEPENDS=['state', 'state_cashbook']
class Line(SecondCurrencyMixin, Workflow, ModelSQL, ModelView):
class Line(SecondCurrencyMixin, MemCacheIndexMx, Workflow, ModelSQL, ModelView):
'Cashbook Line'
__name__ = 'cashbook.line'
@ -64,7 +64,7 @@ class Line(SecondCurrencyMixin, Workflow, ModelSQL, ModelView):
states=STATES, depends=DEPENDS)
descr_short = fields.Function(fields.Char(string='Description', readonly=True),
'on_change_with_descr_short', searcher='search_descr_short')
category = fields.Many2One(string='Category',
category = fields.Many2One(string='Category', select=True,
model_name='cashbook.category', ondelete='RESTRICT',
states={
'readonly': Or(
@ -88,7 +88,7 @@ class Line(SecondCurrencyMixin, Workflow, ModelSQL, ModelView):
states={'invisible': True}), 'on_change_with_booktransf_feature')
bookingtype = fields.Selection(string='Type', required=True,
help='Type of Booking', selection=sel_bookingtype,
help='Type of Booking', selection=sel_bookingtype, select=True,
states=STATES, depends=DEPENDS)
bookingtype_string = bookingtype.translated('bookingtype')
amount = fields.Numeric(string='Amount', digits=(16, Eval('currency_digits', 2)),