From e89896b161eecdd08e1fa46a34c0562abf6563de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 6 Jun 2013 20:41:29 +0200 Subject: [PATCH] Fix date selection when using period in products_by_location effective_date and planned_date could be both NULL so they must be considered as date.max to be included. review897003 (transplanted from 880fcffdafa24b42dc163309b6b24eb3ad5528e4) --- product.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/product.py b/product.py index be694ff1f5..6bb1fd0add 100644 --- a/product.py +++ b/product.py @@ -393,8 +393,8 @@ class Product: if periods: period, = periods state_date_clause += (' AND ' - '(COALESCE(effective_date, planned_date) > %s)') - state_date_vals.append(period.date) + '(COALESCE(effective_date, planned_date, %s) > %s)') + state_date_vals.extend([datetime.date.max, period.date]) period_vals[0] = period.id if with_childs: