From 97d2a46052917bfdb1aa02c28af7f177540834e9 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Mon, 20 May 2019 12:25:53 +0530 Subject: [PATCH] feat: added checkbox in the filter of general ledger to show opening entries --- erpnext/accounts/report/general_ledger/general_ledger.js | 5 +++++ erpnext/accounts/report/general_ledger/general_ledger.py | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/erpnext/accounts/report/general_ledger/general_ledger.js b/erpnext/accounts/report/general_ledger/general_ledger.js index 2826760dd8..e74c16af6f 100644 --- a/erpnext/accounts/report/general_ledger/general_ledger.js +++ b/erpnext/accounts/report/general_ledger/general_ledger.js @@ -211,6 +211,11 @@ frappe.query_reports["General Ledger"] = { "label": __("Currency"), "fieldtype": "Select", "options": erpnext.get_presentation_currency_list() + }, + { + "fieldname": "show_opening_entries", + "label": __("Show Opening Entries"), + "fieldtype": "Check" } ] } diff --git a/erpnext/accounts/report/general_ledger/general_ledger.py b/erpnext/accounts/report/general_ledger/general_ledger.py index 44ca8d3549..1f1f738ff0 100644 --- a/erpnext/accounts/report/general_ledger/general_ledger.py +++ b/erpnext/accounts/report/general_ledger/general_ledger.py @@ -283,7 +283,8 @@ def get_accountwise_gle(filters, gl_entries, gle_map): from_date, to_date = getdate(filters.from_date), getdate(filters.to_date) for gle in gl_entries: - if gle.posting_date < from_date or cstr(gle.is_opening) == "Yes": + if (gle.posting_date < from_date or + (cstr(gle.is_opening) == "Yes" and not filters.get("show_opening_entries"))): update_value_in_dict(gle_map[gle.get(group_by)].totals, 'opening', gle) update_value_in_dict(totals, 'opening', gle)