fix: Use separate condition for tree and normal doctype

This commit is contained in:
Deepesh Garg
2020-04-07 15:17:06 +05:30
parent 96dd2079f3
commit 62e9f83aab
5 changed files with 17 additions and 8 deletions

View File

@@ -202,7 +202,9 @@ def get_conditions(filters):
if frappe.get_cached_value('DocType', dimension.document_type, 'is_tree'):
filters[dimension.fieldname] = get_dimension_with_children(dimension.document_type,
filters.get(dimension.fieldname))
conditions.append("{0} in %({0})s".format(dimension.fieldname))
conditions.append("{0} in %({0})s".format(dimension.fieldname))
else:
conditions.append("{0} in (%({0})s)".format(dimension.fieldname))
return "and {}".format(" and ".join(conditions)) if conditions else ""