From c0709a7b2c8665bc3c1ef20feb516397dd71b65b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 26 Jul 2016 23:07:18 +0200 Subject: [PATCH] Fix default value and check of last_timestamp of Sequence The client integer widget does not allow to display float value. So the default value of last_timestamp is replaced by None which fails later in the check. Also the check must not validate when it is not filled because in Python3 None and int are unorderable. issue5591 review28571002 --- trytond/ir/sequence.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/trytond/ir/sequence.py b/trytond/ir/sequence.py index 7b2c3744fc..75a03809f3 100644 --- a/trytond/ir/sequence.py +++ b/trytond/ir/sequence.py @@ -150,7 +150,7 @@ class Sequence(ModelSQL, ModelView): @staticmethod def default_last_timestamp(): - return 0.0 + return 0 @staticmethod def default_code(): @@ -248,7 +248,8 @@ class Sequence(ModelSQL, ModelView): for sequence in sequences: next_timestamp = cls._timestamp(sequence) - if sequence.last_timestamp > next_timestamp: + if (sequence.last_timestamp is not None + and sequence.last_timestamp > next_timestamp): cls.raise_user_error('future_last_timestamp', ( sequence.rec_name,))