From c2b7084ee89541be935310a025368614de8a8fbf Mon Sep 17 00:00:00 2001 From: deepeshgarg007 Date: Sat, 20 Jul 2019 14:46:59 +0530 Subject: [PATCH 1/3] fix: Condition fix in get_balance_on function --- erpnext/accounts/utils.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/utils.py b/erpnext/accounts/utils.py index aad9621e75f..0ee61eca9cd 100644 --- a/erpnext/accounts/utils.py +++ b/erpnext/accounts/utils.py @@ -121,7 +121,12 @@ def get_balance_on(account=None, date=None, party_type=None, party=None, company allow_cost_center_in_entry_of_bs_account = get_allow_cost_center_in_entry_of_bs_account() - if cost_center and (allow_cost_center_in_entry_of_bs_account or acc.report_type =='Profit and Loss'): + if acc: + report_type == acc.report_type + else: + report_type = "" + + if cost_center and (allow_cost_center_in_entry_of_bs_account or report_type =='Profit and Loss'): cc = frappe.get_doc("Cost Center", cost_center) if cc.is_group: cond.append(""" exists ( @@ -138,7 +143,7 @@ def get_balance_on(account=None, date=None, party_type=None, party=None, company if not frappe.flags.ignore_account_permission: acc.check_permission("read") - if acc.report_type == 'Profit and Loss': + if report_type == 'Profit and Loss': # for pl accounts, get balance within a fiscal year cond.append("posting_date >= '%s' and voucher_type != 'Period Closing Voucher'" \ % year_start_date) From d1d679843ea9df08f70c96f93a0c33ed8219a9a7 Mon Sep 17 00:00:00 2001 From: deepeshgarg007 Date: Sat, 20 Jul 2019 14:49:32 +0530 Subject: [PATCH 2/3] fix: Assignment fix --- erpnext/accounts/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/accounts/utils.py b/erpnext/accounts/utils.py index 0ee61eca9cd..1c073bff1a0 100644 --- a/erpnext/accounts/utils.py +++ b/erpnext/accounts/utils.py @@ -122,7 +122,7 @@ def get_balance_on(account=None, date=None, party_type=None, party=None, company allow_cost_center_in_entry_of_bs_account = get_allow_cost_center_in_entry_of_bs_account() if acc: - report_type == acc.report_type + report_type = acc.report_type else: report_type = "" From c9c48d37368775d03cbae1d6bfd4e3ccdbba9b84 Mon Sep 17 00:00:00 2001 From: deepeshgarg007 Date: Sat, 20 Jul 2019 14:52:59 +0530 Subject: [PATCH 3/3] fix: Condition fix --- erpnext/accounts/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/accounts/utils.py b/erpnext/accounts/utils.py index 1c073bff1a0..b731f049653 100644 --- a/erpnext/accounts/utils.py +++ b/erpnext/accounts/utils.py @@ -121,7 +121,7 @@ def get_balance_on(account=None, date=None, party_type=None, party=None, company allow_cost_center_in_entry_of_bs_account = get_allow_cost_center_in_entry_of_bs_account() - if acc: + if account: report_type = acc.report_type else: report_type = ""