From 44f32c2debab637b41ce046868d181f1446ef769 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Fri, 7 Mar 2014 19:29:33 +0100 Subject: [PATCH] Make amount_second_currency required if second_currency is filled issue3712 review3781004 --- move.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/move.py b/move.py index 83074807f6..ac64fe7a82 100644 --- a/move.py +++ b/move.py @@ -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'