diff --git a/tests/valuestore.py b/tests/valuestore.py index 885c00e..3e559ad 100644 --- a/tests/valuestore.py +++ b/tests/valuestore.py @@ -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, *[ diff --git a/valuestore.py b/valuestore.py index 1a4cabf..e6a238d 100644 --- a/valuestore.py +++ b/valuestore.py @@ -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