formatting, indexes optimized

This commit is contained in:
Frederik Jaeckel 2023-11-29 15:19:38 +01:00
parent 510357a13c
commit 9ee924f0d8
11 changed files with 90 additions and 94 deletions

View file

@ -28,7 +28,9 @@ class Type(ModelSQL, ModelView):
cls._order.insert(0, ('name', 'ASC'))
t = cls.__table__()
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(
@ -53,8 +55,7 @@ class Type(ModelSQL, ModelView):
"""
return '%(short)s - %(name)s' % {
'short': self.short or '-',
'name': self.name or '-',
}
'name': self.name or '-'}
@classmethod
def search_rec_name(cls, name, clause):
@ -63,8 +64,7 @@ class Type(ModelSQL, ModelView):
return [
'OR',
('name',) + tuple(clause[1:]),
('short',) + tuple(clause[1:]),
]
('short',) + tuple(clause[1:])]
@staticmethod
def default_company():