Tryton 6.8: tests, indexes, info

This commit is contained in:
Frederik Jaeckel 2023-06-07 21:52:09 +02:00
parent 765738d9ee
commit 1c5b31d2f1
6 changed files with 37 additions and 28 deletions

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, SymbolMixin
from trytond.model import ModelView, ModelSQL, fields, SymbolMixin, Index
from trytond.transaction import Transaction
from trytond.pool import Pool
from trytond.pyson import Eval, Bool, If, Date
@ -69,7 +69,7 @@ class Asset(SymbolMixin, ModelSQL, ModelView):
'get_rate_data', searcher='search_date')
currency = fields.Many2One(
string='Currency', select=True, required=True,
string='Currency', required=True,
model_name='currency.currency', ondelete='RESTRICT')
currency_digits = fields.Integer(
string='Digits', required=True,
@ -159,6 +159,21 @@ class Asset(SymbolMixin, ModelSQL, ModelView):
super(Asset, cls).__setup__()
cls._order.insert(0, ('name', 'ASC'))
cls._order.insert(0, ('date', 'DESC'))
t = cls.__table__()
cls._sql_indexes.update({
Index(
t,
(t.product, Index.Equality())),
Index(
t,
(t.currency, Index.Equality())),
Index(
t,
(t.uom, Index.Equality())),
Index(
t,
(t.updtdays, Index.Equality())),
})
@classmethod
def migrate_updtsource(cls, module_name):
@ -912,11 +927,11 @@ class AssetSourceRel(ModelSQL):
__name__ = 'investment.asset_source_rel'
source = fields.Many2One(
string='Online Source', select=True,
string='Online Source',
required=True, model_name='investment.source',
ondelete='CASCADE')
asset = fields.Many2One(
string='Asset', select=True,
string='Asset',
required=True, model_name='investment.asset',
ondelete='CASCADE')