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

@@ -419,7 +419,9 @@ def get_additional_conditions(from_date, ignore_closing_entries, 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))
additional_conditions.append("{0} in %({0})s".format(dimension.fieldname))
additional_conditions.append("{0} in %({0})s".format(dimension.fieldname))
else:
additional_conditions.append("{0} in (%({0})s)".format(dimension.fieldname))
return " and {}".format(" and ".join(additional_conditions)) if additional_conditions else ""