Tryton 6.8: tests, indexes, info
This commit is contained in:
parent
765738d9ee
commit
1c5b31d2f1
6 changed files with 37 additions and 28 deletions
|
@ -9,7 +9,7 @@ pip install mds-investment
|
|||
|
||||
Requires
|
||||
========
|
||||
- Tryton 6.0
|
||||
- Tryton 6.8
|
||||
|
||||
How to
|
||||
======
|
||||
|
@ -22,6 +22,6 @@ You can define the course sources yourself.
|
|||
Changes
|
||||
=======
|
||||
|
||||
*6.0.0 - 09.11.2022*
|
||||
*6.8.24 - 07.06.2023*
|
||||
|
||||
- init
|
||||
- portet to Tryton 6.8
|
||||
|
|
23
asset.py
23
asset.py
|
@ -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')
|
||||
|
||||
|
|
16
rate.py
16
rate.py
|
@ -4,7 +4,7 @@
|
|||
# full copyright notices and license terms.
|
||||
|
||||
from trytond.model import (
|
||||
ModelView, ModelSQL, fields, Unique, Check, SymbolMixin)
|
||||
ModelView, ModelSQL, fields, Unique, Check, SymbolMixin, Index)
|
||||
from trytond.transaction import Transaction
|
||||
from trytond.pool import Pool
|
||||
from trytond.pyson import Eval
|
||||
|
@ -15,11 +15,11 @@ class Rate(SymbolMixin, ModelSQL, ModelView):
|
|||
__name__ = 'investment.rate'
|
||||
|
||||
asset = fields.Many2One(
|
||||
string='Asset', required=True, select=True, ondelete='CASCADE',
|
||||
string='Asset', required=True, ondelete='CASCADE',
|
||||
model_name='investment.asset')
|
||||
date = fields.Date(string='Date', required=True, select=True)
|
||||
date = fields.Date(string='Date', required=True)
|
||||
rate = fields.Numeric(
|
||||
string='Rate', required=True, select=True,
|
||||
string='Rate', required=True,
|
||||
digits=(16, Eval('asset_digits', 4)), depends=['asset_digits'])
|
||||
|
||||
asset_digits = fields.Function(fields.Integer(
|
||||
|
@ -46,6 +46,14 @@ class Rate(SymbolMixin, ModelSQL, ModelView):
|
|||
'currency.msg_rate_positive'),
|
||||
]
|
||||
cls._order.insert(0, ('date', 'DESC'))
|
||||
cls._sql_indexes.update({
|
||||
Index(
|
||||
t,
|
||||
(t.date, Index.Range(order='DESC'))),
|
||||
Index(
|
||||
t,
|
||||
(t.rate, Index.Range())),
|
||||
})
|
||||
|
||||
@classmethod
|
||||
def default_date(cls):
|
||||
|
|
3
setup.py
3
setup.py
|
@ -40,7 +40,7 @@ with open(path.join(here, 'versiondep.txt'), encoding='utf-8') as f:
|
|||
|
||||
# tryton-version
|
||||
major_version = 6
|
||||
minor_version = 0
|
||||
minor_version = 8
|
||||
|
||||
requires = ['requests>=2.26', 'html2text']
|
||||
for dep in info.get('depends', []):
|
||||
|
@ -91,6 +91,7 @@ setup(
|
|||
'License :: OSI Approved :: GNU General Public License (GPL)',
|
||||
'Programming Language :: Python :: 3.7',
|
||||
'Programming Language :: Python :: 3.8',
|
||||
'Programming Language :: Python :: 3.9',
|
||||
],
|
||||
|
||||
keywords='tryton investment shares commodities',
|
||||
|
|
|
@ -1,17 +1,2 @@
|
|||
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
# this repository contains the full copyright notices and license terms.
|
||||
|
||||
import trytond.tests.test_tryton
|
||||
import unittest
|
||||
|
||||
from .test_module import InvestmentTestCase
|
||||
|
||||
|
||||
__all__ = ['suite']
|
||||
|
||||
|
||||
def suite():
|
||||
suite = trytond.tests.test_tryton.suite()
|
||||
suite.addTests(unittest.TestLoader().loadTestsFromTestCase(
|
||||
InvestmentTestCase))
|
||||
return suite
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
[tryton]
|
||||
version=6.0.0
|
||||
version=6.8.24
|
||||
depends:
|
||||
ir
|
||||
res
|
||||
|
|
Loading…
Reference in a new issue