From f84e50e616e9fddf51c4d93f29aa18991d4f290e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 19 Jul 2016 07:42:01 +0700 Subject: [PATCH] Allow None in Greater/Less PYSON issue5711 review31361002 --- tryton/pyson.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tryton/pyson.py b/tryton/pyson.py index cc8d0c6e7c..25e881323e 100644 --- a/tryton/pyson.py +++ b/tryton/pyson.py @@ -313,10 +313,10 @@ class Greater(PYSON): super(Greater, self).__init__() for i in (statement1, statement2): if isinstance(i, PYSON): - assert i.types().issubset(set([int, long, float])), \ + assert i.types().issubset({int, long, float, type(None)}), \ 'statement must be an integer or a float' else: - assert isinstance(i, (int, long, float)), \ + assert isinstance(i, (int, long, float, type(None))), \ 'statement must be an integer or a float' if isinstance(equal, PYSON): assert equal.types() == set([bool]) @@ -344,6 +344,8 @@ class Greater(PYSON): @staticmethod def _convert(dct): for i in ('s1', 's2'): + if dct[i] is None: + dct[i] = 0.0 if not isinstance(dct[i], (int, long, float)): dct = dct.copy() dct[i] = float(dct[i])