Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider against_voucher_no when voucher_no is filtered #44533

Merged
merged 4 commits into from
Dec 11, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.group_by and not filters.voucher_no) or (
filters.group_by and filters.group_by != "Group by Voucher"
):
data.append(acc_dict.totals.opening)

data += acc_dict.entries

# totals
data.append(acc_dict.totals.total)
if not (not filters.get("group_by") and filters.voucher_no):
venkat102 marked this conversation as resolved.
Show resolved Hide resolved
data.append(acc_dict.totals.total)

# closing
if filters.get("group_by") != "Group by Voucher":
if (not filters.group_by and not filters.voucher_no) or (
filters.group_by and filters.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
Loading