Tryton 6.8: index, info, tests

This commit is contained in:
Frederik Jaeckel 2023-06-08 17:13:40 +02:00
parent 1f47dfe6b1
commit 21b014183a
7 changed files with 25 additions and 25 deletions

View file

@ -9,7 +9,7 @@ pip install mds-cashbook-investment
Requires
========
- Tryton 6.0
- Tryton 6.8
How to
======
@ -23,6 +23,6 @@ You can monitor trading fees, dividends and sales profits.
Changes
=======
*6.0.0 - 20.12.2022*
*6.8.10 - 08.06.2023*
- init
- compatibility to Tryton 6.8

19
book.py
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 fields, SymbolMixin
from trytond.model import fields, SymbolMixin, Index
from trytond.pool import PoolMeta, Pool
from trytond.pyson import Eval, Or, Len, Bool, If
from trytond.modules.cashbook.book import STATES2, DEPENDS2
@ -42,7 +42,7 @@ class Book(SymbolMixin, metaclass=PoolMeta):
__name__ = 'cashbook.book'
asset = fields.Many2One(
string='Asset', select=True,
string='Asset',
model_name='investment.asset', ondelete='RESTRICT',
states={
'required': Eval('feature', '') == 'asset',
@ -71,7 +71,7 @@ class Book(SymbolMixin, metaclass=PoolMeta):
model_name='product.uom.category',
states={'invisible': True}), 'on_change_with_asset_uomcat')
quantity_uom = fields.Many2One(
string='UOM', select=True,
string='UOM',
model_name='product.uom', ondelete='RESTRICT',
domain=[
('category.id', '=', Eval('asset_uomcat', -1)),
@ -211,6 +211,19 @@ class Book(SymbolMixin, metaclass=PoolMeta):
}, depends=['currency_digits', 'feature']),
'on_change_with_yield_balance')
@classmethod
def __setup__(cls):
super(Book, cls).__setup__()
t = cls.__table__()
cls._sql_indexes.update({
Index(
t,
(t.asset, Index.Equality())),
Index(
t,
(t.quantity_uom, Index.Equality())),
})
@classmethod
def view_attributes(cls):
return super(Book, cls).view_attributes() + [

View file

@ -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 = []
for dep in info.get('depends', []):
@ -92,6 +92,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 cashbook investment',

View file

@ -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 CashbookInvestmentTestCase
__all__ = ['suite']
def suite():
suite = trytond.tests.test_tryton.suite()
suite.addTests(unittest.TestLoader().loadTestsFromTestCase(
CashbookInvestmentTestCase))
return suite

View file

@ -745,7 +745,8 @@ class CbInvTestCase(object):
self.assertRaisesRegex(
UserError,
'A value is required for field "Asset" in "Cashbook".',
'A value is required for field "Asset" in ' +
'"Book 1 | 0.00 usd | Open | 0.0000 u" of "Cashbook".',
Book.write,
*[
[book],

View file

@ -1,5 +1,5 @@
[tryton]
version=6.0.0
version=6.8.10
depends:
cashbook
investment

View file

@ -1 +1 @@
cashbook;6.0.21;6.0.999;mds
cashbook;6.8.28;6.8.999;mds