Get the correct Summation of Closing Balances (#14990)
Fix total raw values for Closing Credit and Closing Debit
This commit is contained in:
parent
20d3bef3c3
commit
cc56ff5c37
@ -162,8 +162,6 @@ def calculate_values(accounts, gl_entries_by_account, opening_balances, filters,
|
|||||||
total_row["credit"] += d["credit"]
|
total_row["credit"] += d["credit"]
|
||||||
total_row["opening_debit"] += d["opening_debit"]
|
total_row["opening_debit"] += d["opening_debit"]
|
||||||
total_row["opening_credit"] += d["opening_credit"]
|
total_row["opening_credit"] += d["opening_credit"]
|
||||||
total_row["closing_debit"] += (d["opening_debit"] + d["debit"])
|
|
||||||
total_row["closing_credit"] += (d["opening_credit"] + d["credit"])
|
|
||||||
|
|
||||||
return total_row
|
return total_row
|
||||||
|
|
||||||
@ -176,6 +174,8 @@ def accumulate_values_into_parents(accounts, accounts_by_name):
|
|||||||
def prepare_data(accounts, filters, total_row, parent_children_map, company_currency):
|
def prepare_data(accounts, filters, total_row, parent_children_map, company_currency):
|
||||||
data = []
|
data = []
|
||||||
|
|
||||||
|
total_row["closing_debit"] = total_row["closing_credit"] = 0
|
||||||
|
|
||||||
for d in accounts:
|
for d in accounts:
|
||||||
has_value = False
|
has_value = False
|
||||||
row = {
|
row = {
|
||||||
@ -200,6 +200,10 @@ def prepare_data(accounts, filters, total_row, parent_children_map, company_curr
|
|||||||
row["has_value"] = has_value
|
row["has_value"] = has_value
|
||||||
data.append(row)
|
data.append(row)
|
||||||
|
|
||||||
|
if not d.parent_account:
|
||||||
|
total_row["closing_debit"] += (d["debit"] - d["credit"]) if (d["debit"] - d["credit"]) > 0 else 0
|
||||||
|
total_row["closing_credit"] += abs(d["debit"] - d["credit"]) if (d["debit"] - d["credit"]) < 0 else 0
|
||||||
|
|
||||||
data.extend([{},total_row])
|
data.extend([{},total_row])
|
||||||
|
|
||||||
return data
|
return data
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user