mirror of
https://github.com/frappe/erpnext.git
synced 2026-02-17 11:44:27 +00:00
fix: adjust a few more queries
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
This commit is contained in:
@@ -11,8 +11,8 @@ import frappe.defaults
|
||||
from frappe import _, qb, throw
|
||||
from frappe.desk.reportview import build_match_conditions
|
||||
from frappe.model.meta import get_field_precision
|
||||
from frappe.query_builder import AliasedQuery, Case, Criterion, Table
|
||||
from frappe.query_builder.functions import Count, Max, Round, Sum
|
||||
from frappe.query_builder import AliasedQuery, Case, Criterion, Field, Table
|
||||
from frappe.query_builder.functions import Count, IfNull, Max, Round, Sum
|
||||
from frappe.query_builder.utils import DocType
|
||||
from frappe.utils import (
|
||||
add_days,
|
||||
@@ -1311,7 +1311,10 @@ def get_children(doctype, parent, company, is_root=False, include_disabled=False
|
||||
if frappe.db.has_column(doctype, "disabled") and not include_disabled:
|
||||
filters.append(["disabled", "=", False])
|
||||
|
||||
filters.append([f'ifnull(`{parent_fieldname}`,"")', "=", "" if is_root else parent])
|
||||
if is_root:
|
||||
filters.append(IfNull(Field(parent_fieldname), "") == "")
|
||||
else:
|
||||
filters.append([parent_fieldname, "=", parent])
|
||||
|
||||
if is_root:
|
||||
fields += ["root_type", "report_type", "account_currency"] if doctype == "Account" else []
|
||||
|
||||
@@ -409,7 +409,9 @@ def get_children(doctype, parent, task=None, project=None, is_root=False):
|
||||
# via expand child
|
||||
filters.append(["parent_task", "=", parent])
|
||||
else:
|
||||
filters.append(['ifnull(`parent_task`, "")', "=", ""])
|
||||
from frappe.query_builder import Field, functions
|
||||
|
||||
filters.append(functions.IfNull(Field("parent_task"), "") == "")
|
||||
|
||||
if project:
|
||||
filters.append(["project", "=", project])
|
||||
|
||||
Reference in New Issue
Block a user