6.0: valuestore - Index() --> select=True, fix tests for 6.0

This commit is contained in:
Frederik Jaeckel 2023-12-31 12:36:03 +01:00
parent 5b8fdd0088
commit 2e9ff5620b
2 changed files with 6 additions and 11 deletions

View file

@ -267,10 +267,10 @@ class ValuestoreTestCase(object):
# check write of too much digits
self.assertRaisesRegex(
UserError,
r'The number of digits in the value ' +
r'"' + r"'12.345'" +
r'" for field "Value" in "[Book 1 | 10\.00 usd | ' +
r'Open]|balance|12\.35|2" of "Value Store" exceeds ' +
r"The number of digits in the value " +
r'"Decimal\(' +
r"'12\.345'\)" +
r'" for field "Value" in "Value Store" exceeds ' +
r'the limit of "2".',
ValueStore.write,
*[

View file

@ -7,7 +7,7 @@
from sql.functions import CurrentTimestamp, DateTrunc
from sql.aggregate import Count
from sql.conditionals import Coalesce
from trytond.model import ModelSQL, fields, Unique, Index
from trytond.model import ModelSQL, fields, Unique
from trytond.pool import Pool
from trytond.transaction import Transaction
from trytond.pyson import Eval, PYSON, PYSONEncoder, PYSONDecoder
@ -22,7 +22,7 @@ class ValueStore(ModelSQL):
cashbook = fields.Many2One(
string='Cashbook', required=True, model_name='cashbook.book',
ondelete='CASCADE')
field_name = fields.Char(string='Field Name', required=True)
field_name = fields.Char(string='Field Name', required=True, select=True)
numvalue = fields.Numeric(
string='Value', digits=(16, Eval('valuedigits', 6)),
depends=['valuedigits'])
@ -39,11 +39,6 @@ class ValueStore(ModelSQL):
Unique(t, t.cashbook, t.field_name),
'cashbook.msg_value_exists_in_store'),
])
cls._sql_indexes.update({
Index(
t,
(t.field_name, Index.Equality())),
})
def get_rec_name(self, name):
""" name, balance, state