fix: use proper ifnull filter
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
This commit is contained in:
parent
5530648ab2
commit
81575386c9
2 changed files with 5 additions and 3 deletions
|
|
@ -9,7 +9,7 @@ from frappe.custom.doctype.property_setter.property_setter import delete_propert
|
|||
from frappe.model import core_doctypes_list
|
||||
from frappe.model.docfield import supports_translation
|
||||
from frappe.model.document import Document
|
||||
from frappe.query_builder.functions import IfNull
|
||||
from frappe.query_builder import Field, functions
|
||||
from frappe.utils import cstr, random_string
|
||||
|
||||
|
||||
|
|
@ -285,7 +285,7 @@ def get_fields_label(doctype=None):
|
|||
def create_custom_field_if_values_exist(doctype, df):
|
||||
df = frappe._dict(df)
|
||||
if df.fieldname in frappe.db.get_table_columns(doctype) and frappe.db.count(
|
||||
dt=doctype, filters=IfNull(df.fieldname, "") != ""
|
||||
dt=doctype, filters=functions.IfNull(Field(df.fieldname), "") != ""
|
||||
):
|
||||
create_custom_field(doctype, df)
|
||||
|
||||
|
|
|
|||
|
|
@ -738,10 +738,12 @@ def get_filter_dashboard_data(stats, doctype, filters=None):
|
|||
continue
|
||||
tagcount = []
|
||||
if tag["type"] not in ["Date", "Datetime"]:
|
||||
from frappe.query_builder import Field, functions
|
||||
|
||||
tagcount = frappe.get_list(
|
||||
doctype,
|
||||
fields=[tag["name"], {"COUNT": "*"}],
|
||||
filters=[*filters, "ifnull(`{}`,'')!=''".format(tag["name"])],
|
||||
filters=[*filters, functions.IfNull(Field(tag["name"]), "") != ""],
|
||||
group_by=tag["name"],
|
||||
as_list=True,
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue