Skip to content

Commit

Permalink
fix: Apply dimension filter, irrespective of dimesion columns
Browse files Browse the repository at this point in the history
(cherry picked from commit 769db0b)
  • Loading branch information
deepeshgarg007 authored and mergify[bot] committed Sep 13, 2023
1 parent 50cfc68 commit 9bc44a3
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions erpnext/accounts/report/general_ledger/general_ledger.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,20 +272,19 @@ def get_conditions(filters):
if match_conditions:
conditions.append(match_conditions)

if filters.get("include_dimensions"):
accounting_dimensions = get_accounting_dimensions(as_list=False)

if accounting_dimensions:
for dimension in accounting_dimensions:
if not dimension.disabled:
if filters.get(dimension.fieldname):
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))
else:
conditions.append("{0} in %({0})s".format(dimension.fieldname))
accounting_dimensions = get_accounting_dimensions(as_list=False)

if accounting_dimensions:
for dimension in accounting_dimensions:
if not dimension.disabled:
if filters.get(dimension.fieldname):
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))
else:
conditions.append("{0} in %({0})s".format(dimension.fieldname))

return "and {}".format(" and ".join(conditions)) if conditions else ""

Expand Down

0 comments on commit 9bc44a3

Please sign in to comment.