fix: Incorrect provisional profit and loss in balance sheet

This commit is contained in:
Deepesh Garg 2022-02-02 22:35:36 +05:30
parent 528c71382f
commit ed2c6b6637
2 changed files with 6 additions and 4 deletions

View File

@ -120,11 +120,11 @@ def check_opening_balance(asset, liability, equity):
opening_balance = 0
float_precision = cint(frappe.db.get_default("float_precision")) or 2
if asset:
opening_balance = flt(asset[0].get("opening_balance", 0), float_precision)
opening_balance = flt(asset[-1].get("opening_balance", 0), float_precision)
if liability:
opening_balance -= flt(liability[0].get("opening_balance", 0), float_precision)
opening_balance -= flt(liability[-1].get("opening_balance", 0), float_precision)
if equity:
opening_balance -= flt(equity[0].get("opening_balance", 0), float_precision)
opening_balance -= flt(equity[-1].get("opening_balance", 0), float_precision)
opening_balance = flt(opening_balance, float_precision)
if opening_balance:

View File

@ -282,7 +282,8 @@ def add_total_row(out, root_type, balance_must_be, period_list, company_currency
total_row = {
"account_name": _("Total {0} ({1})").format(_(root_type), _(balance_must_be)),
"account": _("Total {0} ({1})").format(_(root_type), _(balance_must_be)),
"currency": company_currency
"currency": company_currency,
"opening_balance": 0.0
}
for row in out:
@ -294,6 +295,7 @@ def add_total_row(out, root_type, balance_must_be, period_list, company_currency
total_row.setdefault("total", 0.0)
total_row["total"] += flt(row["total"])
total_row["opening_balance"] += row["opening_balance"]
row["total"] = ""
if "total" in total_row: