fix: Condition fix in get_balance_on function
This commit is contained in:
parent
d1d8d24d0f
commit
1ee3d040a1
@ -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()
|
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)
|
cc = frappe.get_doc("Cost Center", cost_center)
|
||||||
if cc.is_group:
|
if cc.is_group:
|
||||||
cond.append(""" exists (
|
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:
|
if not frappe.flags.ignore_account_permission:
|
||||||
acc.check_permission("read")
|
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
|
# for pl accounts, get balance within a fiscal year
|
||||||
cond.append("posting_date >= '%s' and voucher_type != 'Period Closing Voucher'" \
|
cond.append("posting_date >= '%s' and voucher_type != 'Period Closing Voucher'" \
|
||||||
% year_start_date)
|
% year_start_date)
|
||||||
|
Loading…
Reference in New Issue
Block a user