From 715ed9dede9fd2fc37c58239220df50b2e300470 Mon Sep 17 00:00:00 2001 From: Bertrand Chenal Date: Thu, 18 Dec 2008 20:12:47 +0100 Subject: [PATCH] Fix null date handling --- product.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/product.py b/product.py index 6a52df3f74..4f70a80283 100644 --- a/product.py +++ b/product.py @@ -169,7 +169,7 @@ class Product(OSV): and not context.get('forecast')): state_date_clause = '((state in (%s, %s)) AND ('\ '(effective_date IS NULL '\ - 'AND ( planned_date <= %s or planned_date IS NULL)) '\ + 'AND ( planned_date <= %s)) '\ 'OR effective_date <= %s'\ '))' state_date_vals = ["done", @@ -188,14 +188,14 @@ class Product(OSV): state_date_clause = '((' + \ '(state in (%s, %s)) AND ('\ '(effective_date IS NULL '\ - 'AND ( planned_date <= %s or planned_date IS NULL)) '\ + 'AND ( planned_date <= %s )) '\ 'OR effective_date <= %s)' \ + \ ') OR (' + \ '(state in (%s, %s, %s)) AND ('\ '(effective_date IS NULL '\ - 'AND (( planned_date <= %s AND planned_date >= %s ) '\ - 'OR planned_date IS NULL)) '\ + 'AND ( planned_date <= %s AND planned_date >= %s '\ + ')) '\ 'OR (effective_date <= %s AND effective_date >= %s)'\ ')'\ '))' @@ -212,7 +212,7 @@ class Product(OSV): context=context): state_date_clause += ' AND ((state in (%s, %s, %s)) AND ('\ '(effective_date IS NULL '\ - 'AND ( planned_date >= %s)) '\ + 'AND ( planned_date >= %s OR planned_date IS NULL)) '\ 'OR effective_date >= %s'\ '))' state_date_vals.extend( @@ -221,7 +221,7 @@ class Product(OSV): else: tmp_clause = '(state in (%s, %s, %s)) AND ('\ '(effective_date IS NULL '\ - 'AND ( planned_date >= %s)) '\ + 'AND ( planned_date >= %s OR planned_date IS NULL)) '\ 'OR effective_date >= %s'\ ')' today = date_obj.today(cursor, user, context=context) @@ -233,7 +233,7 @@ class Product(OSV): '(state in (%s, %s)) AND ('\ '(effective_date IS NULL '\ 'AND (( planned_date >= %s AND planned_date < %s ) '\ - ')) '\ + 'OR planned_date IS NULL)) '\ 'OR (effective_date >= %s AND effective_date < %s)'\ ')'\ '))'