From 7e407630c632852eed45b79e9dee1da00f1c1981 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sun, 21 Aug 2011 11:20:40 +0200 Subject: [PATCH] Make PYSON more Pythonic --- company.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/company.py b/company.py index 165c40239c..5dd17f5da2 100644 --- a/company.py +++ b/company.py @@ -4,7 +4,7 @@ import copy from trytond.model import ModelView, ModelSQL, fields from trytond.wizard import Wizard from trytond.report import Report -from trytond.pyson import Eval, If, In, Get +from trytond.pyson import Eval, If from trytond.transaction import Transaction from trytond.pool import Pool @@ -207,9 +207,9 @@ User() class Property(ModelSQL, ModelView): _name = 'ir.property' company = fields.Many2One('company.company', 'Company', - domain=[ - ('id', If(In('company', Eval('context', {})), '=', '!='), - Get(Eval('context', {}), 'company', 0)), + domain=[ + ('id', If(Eval('context', {}).contains('company'), '=', '!='), + Eval('context', {}).get('company', 0)), ]) def _set_values(self, name, model, res_id, val, field_id): @@ -236,9 +236,9 @@ Property() class Sequence(ModelSQL, ModelView): _name = 'ir.sequence' company = fields.Many2One('company.company', 'Company', - domain=[ - ('id', If(In('company', Eval('context', {})), '=', '!='), - Get(Eval('context', {}), 'company', 0)), + domain=[ + ('id', If(Eval('context', {}).contains('company'), '=', '!='), + Eval('context', {}).get('company', 0)), ]) def __init__(self):