diff --git a/README.rst b/README.rst index 8d37f4b..1f48f27 100644 --- a/README.rst +++ b/README.rst @@ -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 diff --git a/asset.py b/asset.py index 03a74e5..d599d7b 100644 --- a/asset.py +++ b/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') diff --git a/rate.py b/rate.py index 0aab598..eef697c 100644 --- a/rate.py +++ b/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): diff --git a/setup.py b/setup.py index 2b79c37..58979c0 100644 --- a/setup.py +++ b/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', diff --git a/tests/__init__.py b/tests/__init__.py index 27a7d83..4effdfa 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -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 diff --git a/tryton.cfg b/tryton.cfg index 9f0f95f..4ba63f6 100644 --- a/tryton.cfg +++ b/tryton.cfg @@ -1,5 +1,5 @@ [tryton] -version=6.0.0 +version=6.8.24 depends: ir res