Skip to content

Commit

Permalink
chore: change f-string to sql params
Browse files Browse the repository at this point in the history
  • Loading branch information
rtdany10 committed Nov 21, 2023
1 parent bfaa93b commit 61f27bb
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions erpnext/accounts/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,11 +282,22 @@ def get_balance_on(
cond.append("""gle.company = %s """ % (frappe.db.escape(company, percent=False)))

if account or (party_type and party) or account_type:
precision = get_currency_precision()
precision = frappe.db.escape(get_currency_precision())
if in_account_currency:
select_field = f"sum(round(debit_in_account_currency, {precision})) - sum(round(credit_in_account_currency, {precision}))"
select_field = """
sum(round(debit_in_account_currency, %s)) - sum(round(credit_in_account_currency, %s))
""" % (
precision,
precision,
)
else:
select_field = f"sum(round(debit, {precision})) - sum(round(credit, {precision}))"
select_field = """
sum(round(debit, %s)) - sum(round(credit, %s))
""" % (
precision,
precision,
)

bal = frappe.db.sql(
"""
SELECT {0}
Expand Down

0 comments on commit 61f27bb

Please sign in to comment.