From 6453b1ec573a5bf7ea3e584c8acf78fbedd38823 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sun, 21 Aug 2011 11:20:49 +0200 Subject: [PATCH] Make PYSON more Pythonic --- work.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/work.py b/work.py index e64bbbd2f7..c5c419b147 100644 --- a/work.py +++ b/work.py @@ -2,7 +2,7 @@ #this repository contains the full copyright notices and license terms. from decimal import Decimal from trytond.model import ModelView, ModelSQL, fields -from trytond.pyson import Not, Equal, Eval +from trytond.pyson import Eval from trytond.transaction import Transaction from trytond.pool import Pool @@ -34,20 +34,20 @@ class Work(ModelSQL, ModelView): _name = 'project.work' product = fields.Many2One('product.product', 'Product', - states={ - 'invisible': Not(Equal(Eval('type'), 'task')), + states={ + 'invisible': Eval('type') != 'task', }, on_change=['product', 'party', 'hours', 'company'], depends=['type', 'party', 'hours', 'company']) list_price = fields.Numeric('List Price', - digits=(16, Eval('currency_digits', 2)), - states={ - 'invisible': Not(Equal(Eval('type'), 'task')), - }, depends=['type', 'currency_digits']) - revenue = fields.Function(fields.Numeric('Revenue', digits=(16, Eval('currency_digits', 2)), states={ - 'invisible': Not(Equal(Eval('type'), 'project')), - }, depends=['type', 'currency_digits']), 'get_revenue') + 'invisible': Eval('type') != 'task', + }, depends=['type', 'currency_digits']) + revenue = fields.Function(fields.Numeric('Revenue', + digits=(16, Eval('currency_digits', 2)), + states={ + 'invisible': Eval('type') != 'project', + }, depends=['type', 'currency_digits']), 'get_revenue') cost = fields.Function(fields.Numeric('Cost', digits=(16, Eval('currency_digits', 2)), depends=['currency_digits']), 'get_cost')