amount/rate/amount_2nd - ok+test
This commit is contained in:
parent
517e2c5ad3
commit
0f6180ebdb
3 changed files with 106 additions and 49 deletions
10
book.py
10
book.py
|
@ -4,7 +4,7 @@
|
|||
# full copyright notices and license terms.
|
||||
|
||||
from trytond.model import Workflow, ModelView, ModelSQL, fields, Check, tree
|
||||
from trytond.pyson import Eval, Or, Bool, Id
|
||||
from trytond.pyson import Eval, Or, Bool, Id, Len
|
||||
from trytond.exceptions import UserError
|
||||
from trytond.i18n import gettext
|
||||
from trytond.transaction import Transaction
|
||||
|
@ -59,7 +59,7 @@ class Book(tree(separator='/'), Workflow, ModelSQL, ModelView):
|
|||
states={
|
||||
'readonly': Or(
|
||||
STATES['readonly'],
|
||||
Bool(Eval('lines')),
|
||||
Len(Eval('lines')) > 0,
|
||||
),
|
||||
}, depends=DEPENDS+['lines'])
|
||||
owner = fields.Many2One(string='Owner', required=True, select=True,
|
||||
|
@ -97,7 +97,7 @@ class Book(tree(separator='/'), Workflow, ModelSQL, ModelView):
|
|||
states={
|
||||
'readonly': Or(
|
||||
STATES2['readonly'],
|
||||
Bool(Eval('lines')),
|
||||
Len(Eval('lines')) > 0,
|
||||
),
|
||||
'invisible': STATES2['invisible'],
|
||||
'required': ~STATES2['invisible'],
|
||||
|
@ -122,11 +122,11 @@ class Book(tree(separator='/'), Workflow, ModelSQL, ModelView):
|
|||
'on_change_with_currency_digits')
|
||||
|
||||
currency = fields.Many2One(string='Currency', select=True,
|
||||
model_name='currency.currency', readonly=True,
|
||||
model_name='currency.currency',
|
||||
states={
|
||||
'readonly': Or(
|
||||
STATES2['readonly'],
|
||||
Bool(Eval('lines', [])),
|
||||
Len(Eval('lines', [])) > 0,
|
||||
),
|
||||
}, depends=DEPENDS2+['lines'])
|
||||
currency_digits = fields.Function(fields.Integer(string='Currency Digits',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue