From 181156bf6623205936fa1e2b288e253c0d4eab9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Fri, 9 Mar 2018 19:41:13 +0100 Subject: [PATCH] Prevent to compare datetime.date to NoneType This may happen if stock_date_end is not set in the context. --- location.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/location.py b/location.py index eddb1c0d33..ecc232e2f9 100644 --- a/location.py +++ b/location.py @@ -318,7 +318,8 @@ class Location(ModelSQL, ModelView): context = {} if (name == 'quantity' - and trans_context.get('stock_date_end') > Date_.today()): + and (trans_context.get('stock_date_end', datetime.date.max) + > Date_.today())): context['stock_date_end'] = Date_.today() if name == 'forecast_quantity':