Skip to content

Commit

Permalink
Merge pull request #44533 from aerele/consolidated-gl
Browse files Browse the repository at this point in the history
Consider against_voucher_no when voucher_no is filtered
  • Loading branch information
venkat102 authored Dec 11, 2024
1 parent 67ac3a5 commit 3595783
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions erpnext/accounts/report/general_ledger/general_ledger.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@ def execute(filters=None):
if filters.get("party"):
filters.party = frappe.parse_json(filters.get("party"))

if filters.get("voucher_no") and not filters.get("group_by"):
filters.group_by = "Group by Voucher (Consolidated)"

validate_filters(filters, account_details)

validate_party(filters)
Expand Down Expand Up @@ -373,16 +370,21 @@ def get_data_with_opening_closing(filters, account_details, accounting_dimension
if acc_dict.entries:
# opening
data.append({"debit_in_transaction_currency": None, "credit_in_transaction_currency": None})
if filters.get("group_by") != "Group by Voucher":
if (not filters.get("group_by") and not filters.get("voucher_no")) or (
filters.get("group_by") and filters.get("group_by") != "Group by Voucher"
):
data.append(acc_dict.totals.opening)

data += acc_dict.entries

# totals
data.append(acc_dict.totals.total)
if filters.get("group_by") or not filters.voucher_no:
data.append(acc_dict.totals.total)

# closing
if filters.get("group_by") != "Group by Voucher":
if (not filters.get("group_by") and not filters.get("voucher_no")) or (
filters.get("group_by") and filters.get("group_by") != "Group by Voucher"
):
data.append(acc_dict.totals.closing)

data.append({"debit_in_transaction_currency": None, "credit_in_transaction_currency": None})
Expand Down

0 comments on commit 3595783

Please sign in to comment.