From 437b32d32c524efdc4930068204f696ca29e00fe Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 17 Oct 2016 16:57:52 +0530 Subject: [PATCH] Added filter to show unclosed fiscal year's P&L balances in trail balance --- erpnext/accounts/report/trial_balance/trial_balance.js | 5 +++++ erpnext/accounts/report/trial_balance/trial_balance.py | 3 +++ 2 files changed, 8 insertions(+) diff --git a/erpnext/accounts/report/trial_balance/trial_balance.js b/erpnext/accounts/report/trial_balance/trial_balance.js index 9943e5d0e3..ff198e9d3e 100644 --- a/erpnext/accounts/report/trial_balance/trial_balance.js +++ b/erpnext/accounts/report/trial_balance/trial_balance.js @@ -55,6 +55,11 @@ frappe.require("assets/erpnext/js/financial_statements.js", function() { "label": __("Show zero values"), "fieldtype": "Check" }, + { + "fieldname": "show_unclosed_fy_pl_balances", + "label": __("Show unclosed fiscal year's P&L balances"), + "fieldtype": "Check" + } ], "formatter": erpnext.financial_statements.formatter, "tree": true, diff --git a/erpnext/accounts/report/trial_balance/trial_balance.py b/erpnext/accounts/report/trial_balance/trial_balance.py index b4babcde8e..7609d1d95b 100644 --- a/erpnext/accounts/report/trial_balance/trial_balance.py +++ b/erpnext/accounts/report/trial_balance/trial_balance.py @@ -88,6 +88,9 @@ def get_opening_balances(filters): def get_rootwise_opening_balances(filters, report_type): additional_conditions = "" + if not filters.show_unclosed_fy_pl_balances: + additional_conditions = " and posting_date >= %(year_start_date)s" \ + if report_type == "Profit and Loss" else "" if not flt(filters.with_period_closing_entry): additional_conditions += " and ifnull(voucher_type, '')!='Period Closing Voucher'"