6.0: valuestore - Index() --> select=True, fix tests for 6.0
This commit is contained in:
parent
5b8fdd0088
commit
2e9ff5620b
2 changed files with 6 additions and 11 deletions
|
@ -267,10 +267,10 @@ class ValuestoreTestCase(object):
|
||||||
# check write of too much digits
|
# check write of too much digits
|
||||||
self.assertRaisesRegex(
|
self.assertRaisesRegex(
|
||||||
UserError,
|
UserError,
|
||||||
r'The number of digits in the value ' +
|
r"The number of digits in the value " +
|
||||||
r'"' + r"'12.345'" +
|
r'"Decimal\(' +
|
||||||
r'" for field "Value" in "[Book 1 | 10\.00 usd | ' +
|
r"'12\.345'\)" +
|
||||||
r'Open]|balance|12\.35|2" of "Value Store" exceeds ' +
|
r'" for field "Value" in "Value Store" exceeds ' +
|
||||||
r'the limit of "2".',
|
r'the limit of "2".',
|
||||||
ValueStore.write,
|
ValueStore.write,
|
||||||
*[
|
*[
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
from sql.functions import CurrentTimestamp, DateTrunc
|
from sql.functions import CurrentTimestamp, DateTrunc
|
||||||
from sql.aggregate import Count
|
from sql.aggregate import Count
|
||||||
from sql.conditionals import Coalesce
|
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.pool import Pool
|
||||||
from trytond.transaction import Transaction
|
from trytond.transaction import Transaction
|
||||||
from trytond.pyson import Eval, PYSON, PYSONEncoder, PYSONDecoder
|
from trytond.pyson import Eval, PYSON, PYSONEncoder, PYSONDecoder
|
||||||
|
@ -22,7 +22,7 @@ class ValueStore(ModelSQL):
|
||||||
cashbook = fields.Many2One(
|
cashbook = fields.Many2One(
|
||||||
string='Cashbook', required=True, model_name='cashbook.book',
|
string='Cashbook', required=True, model_name='cashbook.book',
|
||||||
ondelete='CASCADE')
|
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(
|
numvalue = fields.Numeric(
|
||||||
string='Value', digits=(16, Eval('valuedigits', 6)),
|
string='Value', digits=(16, Eval('valuedigits', 6)),
|
||||||
depends=['valuedigits'])
|
depends=['valuedigits'])
|
||||||
|
@ -39,11 +39,6 @@ class ValueStore(ModelSQL):
|
||||||
Unique(t, t.cashbook, t.field_name),
|
Unique(t, t.cashbook, t.field_name),
|
||||||
'cashbook.msg_value_exists_in_store'),
|
'cashbook.msg_value_exists_in_store'),
|
||||||
])
|
])
|
||||||
cls._sql_indexes.update({
|
|
||||||
Index(
|
|
||||||
t,
|
|
||||||
(t.field_name, Index.Equality())),
|
|
||||||
})
|
|
||||||
|
|
||||||
def get_rec_name(self, name):
|
def get_rec_name(self, name):
|
||||||
""" name, balance, state
|
""" name, balance, state
|
||||||
|
|
Loading…
Reference in a new issue