diff --git a/product_oneclick.py b/product_oneclick.py index b562d86..0f1427f 100644 --- a/product_oneclick.py +++ b/product_oneclick.py @@ -3,7 +3,7 @@ # the full copyright notices and license terms. from trytond.model import fields from trytond.pool import PoolMeta -from trytond.pyson import Eval, Bool +from trytond.pyson import Eval, Not, Bool from trytond.model.fields import depends __all__ = ['ProductOneClickView', 'ProductOneClick'] @@ -42,6 +42,13 @@ class ProductOneClickView: res['training_registration'] = self.training_start_date return res + @classmethod + def view_attributes(cls): + return super(ProductOneClickView, cls).view_attributes() + [ + ('//page[@id="esale"]', 'states', { + 'invisible': Not(Bool(Eval('training'))), + })] + class ProductOneClick: __name__ = 'product.oneclick' diff --git a/view/product_oneclick_view_form.xml b/view/product_oneclick_view_form.xml index d55285f..94b0e14 100644 --- a/view/product_oneclick_view_form.xml +++ b/view/product_oneclick_view_form.xml @@ -8,9 +8,7 @@ The COPYRIGHT file at the top level of this repository contains the full copyrig - +