From 2b0c2595c7329112078a372c82d7621299c6d5ae Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Mon, 30 Dec 2013 18:55:51 +0530 Subject: [PATCH] Reportview Filters null value fix --- webnotes/widgets/reportview.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/webnotes/widgets/reportview.py b/webnotes/widgets/reportview.py index 38034a74ee..5a47ebe0bb 100644 --- a/webnotes/widgets/reportview.py +++ b/webnotes/widgets/reportview.py @@ -184,15 +184,15 @@ def build_filter_conditions(filters, conditions): "fieldname": f[1]}) if df and df[0].fieldtype in ["Float", "Int", "Currency", "Percent"]: - val, default_null_val = flt(f[3]), 0 + val, default_null_val = flt(f[3]), "0" else: - val, default_null_val = ("'" + f[3].replace("'", "\\'") + "'"), "" + val, default_null_val = ("'" + f[3].replace("'", "\\'") + "'"), '""' else: - val, default_null_val = f[3], 0 + val, default_null_val = f[3], '0' - conditions.append('ifnull(' + tname + '.' + f[1] + ", '"+ default_null_val +"') " \ - + f[2] + " " + cstr(val)) - + conditions.append('ifnull({tname}.{fname}, {default_val}) {operator} {value}'.format( + tname=tname, fname=f[1], default_val=default_null_val, operator=f[2], + value=cstr(val))) def build_match_conditions(doctype, fields=None, as_condition=True): """add match conditions if applicable"""