Remove safe eval

This commit is contained in:
resteve 2015-08-23 19:18:36 +02:00
parent faed5874b2
commit bd602ee910
2 changed files with 9 additions and 4 deletions

View File

@ -3,7 +3,7 @@
# the full copyright notices and license terms. # the full copyright notices and license terms.
from trytond.model import fields from trytond.model import fields
from trytond.pool import PoolMeta 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 from trytond.modules.product_esale.tools import slugify
__all__ = ['ProductOneClickView', 'ProductOneClick'] __all__ = ['ProductOneClickView', 'ProductOneClick']
@ -86,6 +86,13 @@ class ProductOneClickView:
name = slugify(name) name = slugify(name)
return 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: class ProductOneClick:
__name__ = 'product.oneclick' __name__ = 'product.oneclick'

View File

@ -8,9 +8,7 @@ The COPYRIGHT file at the top level of this repository contains the full copyrig
<field name="esale_available"/> <field name="esale_available"/>
</xpath> </xpath>
<xpath expr="/form/notebook/page[@id='sale']" position="after"> <xpath expr="/form/notebook/page[@id='sale']" position="after">
<page string="eSale" <page string="eSale" id="esale">
states="{'invisible': Not(Bool(Eval('esale_available')))}"
id="esale">
<notebook colspan="6"> <notebook colspan="6">
<page string="General" id="esale-general"> <page string="General" id="esale-general">
<label name="esale_active"/> <label name="esale_active"/>