line, type: fix index

This commit is contained in:
Frederik Jaeckel 2023-06-08 17:08:47 +02:00
parent eaa502a626
commit 3a0df50d52
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())), (t.state, Index.Equality())),
Index( Index(
t, t,
(t.reference, Index.Range())), (t.reference, Index.Equality())),
}) })
cls._sql_constraints.extend([ cls._sql_constraints.extend([
('state_val2', ('state_val2',

View file

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