Make amount_second_currency required if second_currency is filled

issue3712
review3781004
This commit is contained in:
Cédric Krier committed 2014-03-07 19:29:33 +01:00
1 parent 47ee8f74d7
commit 44f32c2deb
1 file changed
+10 -3
+10 -3
View File
@@ -12,7 +12,7 @@ from trytond.wizard import Wizard, StateTransition, StateView, StateAction, \
Button
from trytond.report import Report
from trytond import backend
from trytond.pyson import Eval, PYSONEncoder
from trytond.pyson import Eval, Bool, PYSONEncoder
from trytond.transaction import Transaction
from trytond.pool import Pool, PoolMeta
from trytond.rpc import RPC
@@ -526,9 +526,16 @@ class Line(ModelSQL, ModelView):
amount_second_currency = fields.Numeric('Amount Second Currency',
digits=(16, Eval('second_currency_digits', 2)),
help='The amount expressed in a second currency',
depends=['second_currency_digits'])
states={
'required': Bool(Eval('second_currency')),
},
depends=['second_currency_digits', 'second_currency'])
second_currency = fields.Many2One('currency.currency', 'Second Currency',
help='The second currency')
help='The second currency',
states={
'required': Bool(Eval('amount_second_currency')),
},
depends=['amount_second_currency'])
party = fields.Many2One('party.party', 'Party', select=True)
maturity_date = fields.Date('Maturity Date',
help='This field is used for payable and receivable lines. \n'