line, type: fix index

This commit is contained in:
Frederik Jaeckel 2023-06-08 17:08:47 +02:00
parent 2b6731d071
commit e605d5f0d3
2 changed files with 7 additions and 2 deletions

View file

@ -245,7 +245,7 @@ class Line(SecondCurrencyMixin, MemCacheIndexMx, Workflow, ModelSQL, ModelView):
(t.state, Index.Equality())),
Index(
t,
(t.reference, Index.Range())),
(t.reference, Index.Equality())),
})
cls._sql_constraints.extend([
('state_val2',

View file

@ -3,7 +3,7 @@
# The COPYRIGHT file at the top level of this repository contains the
# full copyright notices and license terms.
from trytond.model import ModelView, ModelSQL, fields, Unique
from trytond.model import ModelView, ModelSQL, fields, Unique, Index
from trytond.transaction import Transaction
from trytond.i18n import gettext
@ -30,6 +30,11 @@ class Type(ModelSQL, ModelView):
cls._sql_constraints.extend([
('code_uniq', Unique(t, t.short), 'cashbook.msg_type_short_unique'),
])
cls._sql_indexes.update({
Index(
t,
(t.feature, Index.Equality())),
})
@classmethod
def default_feature(cls):