Selaa lähdekoodia

Merge pull request #381 from anandpdoshi/hotfix-reportview-filters

Reportview Filters null value fix
version-14
Pratik Vyas 11 vuotta sitten
vanhempi
commit
c99feef3cf
1 muutettua tiedostoa jossa 6 lisäystä ja 6 poistoa
  1. +6
    -6
      webnotes/widgets/reportview.py

+ 6
- 6
webnotes/widgets/reportview.py Näytä tiedosto

@@ -184,15 +184,15 @@ def build_filter_conditions(filters, conditions):
"fieldname": f[1]}) "fieldname": f[1]})
if df and df[0].fieldtype in ["Float", "Int", "Currency", "Percent"]: 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: else:
val, default_null_val = ("'" + f[3].replace("'", "\\'") + "'"), ""
val, default_null_val = ("'" + f[3].replace("'", "\\'") + "'"), '""'
else: 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): def build_match_conditions(doctype, fields=None, as_condition=True):
"""add match conditions if applicable""" """add match conditions if applicable"""


Ladataan…
Peruuta
Tallenna