mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-31 10:49:09 +00:00
fix: Apply finance book filter conditionally
This commit is contained in:
@@ -300,20 +300,17 @@ def get_balance_on(
|
|||||||
cond.append("""gle.company = %s """ % (frappe.db.escape(company)))
|
cond.append("""gle.company = %s """ % (frappe.db.escape(company)))
|
||||||
default_finance_book = frappe.get_cached_value("Company", company, "default_finance_book")
|
default_finance_book = frappe.get_cached_value("Company", company, "default_finance_book")
|
||||||
|
|
||||||
if default_finance_book:
|
if finance_book:
|
||||||
if finance_book:
|
if default_finance_book and include_default_fb_balances:
|
||||||
if include_default_fb_balances:
|
cond.append(
|
||||||
cond.append(
|
f"gle.finance_book IN ({frappe.db.escape(finance_book)}, {frappe.db.escape(default_finance_book)})"
|
||||||
f"""gle.finance_book IN (
|
)
|
||||||
{frappe.db.escape(finance_book)},
|
|
||||||
{frappe.db.escape(default_finance_book)}
|
|
||||||
)"""
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
cond.append(f"""gle.finance_book = {frappe.db.escape(finance_book)}""")
|
|
||||||
else:
|
else:
|
||||||
if include_default_fb_balances:
|
cond.append(f"gle.finance_book = {frappe.db.escape(finance_book)}")
|
||||||
cond.append(f"""gle.finance_book = {frappe.db.escape(default_finance_book)}""")
|
|
||||||
|
elif default_finance_book and include_default_fb_balances:
|
||||||
|
# No finance book passed → fall back to default
|
||||||
|
cond.append(f"gle.finance_book = {frappe.db.escape(default_finance_book)}")
|
||||||
|
|
||||||
if account or (party_type and party) or account_type:
|
if account or (party_type and party) or account_type:
|
||||||
precision = get_currency_precision()
|
precision = get_currency_precision()
|
||||||
|
|||||||
Reference in New Issue
Block a user