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

@ -12,7 +12,7 @@ from trytond.i18n import gettext
from trytond.transaction import Transaction
from .line import sel_linetype, sel_bookingtype, STATES, DEPENDS
from .book import sel_state_book
from .mixin import SecondCurrencyMixin
from .mixin import SecondCurrencyMixin, MemCacheIndexMx
sel_linetype = [
@ -26,7 +26,7 @@ sel_target = [
]
class SplitLine(SecondCurrencyMixin, ModelSQL, ModelView):
class SplitLine(SecondCurrencyMixin, MemCacheIndexMx, ModelSQL, ModelView):
'Split booking line'
__name__ = 'cashbook.split'
@ -37,8 +37,8 @@ class SplitLine(SecondCurrencyMixin, ModelSQL, ModelView):
states=STATES, depends=DEPENDS)
splittype = fields.Selection(string='Type', required=True,
help='Type of split booking line', selection=sel_linetype,
states=STATES, depends=DEPENDS)
category = fields.Many2One(string='Category',
states=STATES, depends=DEPENDS, select=True)
category = fields.Many2One(string='Category', select=True,
model_name='cashbook.category', ondelete='RESTRICT',
states={
'readonly': STATES['readonly'],
@ -59,7 +59,7 @@ class SplitLine(SecondCurrencyMixin, ModelSQL, ModelView):
('owner.id', '=', Eval('owner_cashbook', -1)),
('id', '!=', Eval('cashbook', -1)),
('btype', '!=', None),
],
], select=True,
states={
'readonly': STATES['readonly'],
'invisible': Eval('splittype', '') != 'tr',