From a5fe0dd36f79f13327b4ad2968c0ad803161120e Mon Sep 17 00:00:00 2001 From: jmartin Date: Wed, 9 Jul 2014 10:52:33 +0200 Subject: [PATCH] Make pay button readonly if no lines are added to sale --- sale.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sale.py b/sale.py index 564dc85..745b886 100644 --- a/sale.py +++ b/sale.py @@ -5,7 +5,7 @@ from decimal import Decimal from trytond.model import ModelView, fields from trytond.pool import PoolMeta, Pool -from trytond.pyson import Eval +from trytond.pyson import Bool, Eval, Not from trytond.transaction import Transaction from trytond.wizard import Wizard, StateView, StateTransition, Button @@ -28,6 +28,7 @@ class Sale: cls._buttons.update({ 'wizard_sale_payment': { 'invisible': Eval('state') == 'done', + 'readonly': Not(Bool(Eval('lines'))), }, })