Remove safe eval

This commit is contained in:
resteve 2015-08-23 19:26:41 +02:00
parent 5292bb7d77
commit 1d1cc4a9c7
2 changed files with 9 additions and 4 deletions

View File

@ -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'

View File

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