Skip to content

Commit

Permalink
fix: correcting balance sheet calculation for zero liabilities and eq…
Browse files Browse the repository at this point in the history
…uity (#41497)

* fix: correcting balance sheet calculation for zero liabilities and equity

* fix: correcting balance sheet calculation for zero liabilities and equity

(cherry picked from commit 3c33135)

# Conflicts:
#	erpnext/accounts/report/balance_sheet/balance_sheet.py
  • Loading branch information
Nihantra-Patel authored and mergify[bot] committed Jun 3, 2024
1 parent 8ff5a67 commit 2104d90
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion erpnext/accounts/report/balance_sheet/balance_sheet.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def get_provisional_profit_loss(
):
provisional_profit_loss = {}
total_row = {}
if asset and (liability or equity):
if asset:
total = total_row_total = 0
currency = currency or frappe.get_cached_value("Company", company, "default_currency")
total_row = {
Expand All @@ -122,6 +122,7 @@ def get_provisional_profit_loss(

for period in period_list:
key = period if consolidated else period.key
<<<<<<< HEAD
effective_liability = 0.0
if liability:
effective_liability += flt(liability[-2].get(key))
Expand All @@ -130,6 +131,22 @@ def get_provisional_profit_loss(

provisional_profit_loss[key] = flt(asset[-2].get(key)) - effective_liability
total_row[key] = effective_liability + provisional_profit_loss[key]
=======
total_assets = flt(asset[0].get(key))

if liability or equity:
effective_liability = 0.0
if liability:
effective_liability += flt(liability[0].get(key))
if equity:
effective_liability += flt(equity[0].get(key))

provisional_profit_loss[key] = total_assets - effective_liability
else:
provisional_profit_loss[key] = total_assets

total_row[key] = provisional_profit_loss[key]
>>>>>>> 3c3313594d (fix: correcting balance sheet calculation for zero liabilities and equity (#41497))

if provisional_profit_loss[key]:
has_value = True
Expand Down

0 comments on commit 2104d90

Please sign in to comment.