From bd602ee910253fdb6188e356611333f7eed15d61 Mon Sep 17 00:00:00 2001 From: resteve Date: Sun, 23 Aug 2015 19:18:36 +0200 Subject: [PATCH] Remove safe eval --- product_oneclick.py | 9 ++++++++- view/product_oneclick_view_form.xml | 4 +--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/product_oneclick.py b/product_oneclick.py index 35c719e..35ba624 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 +from trytond.pyson import Eval, Not, Bool from trytond.modules.product_esale.tools import slugify __all__ = ['ProductOneClickView', 'ProductOneClick'] @@ -86,6 +86,13 @@ class ProductOneClickView: name = slugify(name) return name + @classmethod + def view_attributes(cls): + return super(ProductOneClickView, cls).view_attributes() + [ + ('//page[@id="esale"]', 'states', { + 'invisible': Not(Bool(Eval('esale_available'))), + })] + class ProductOneClick: __name__ = 'product.oneclick' diff --git a/view/product_oneclick_view_form.xml b/view/product_oneclick_view_form.xml index 34b4444..5616cb0 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 - +