mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-01 04:28:27 +00:00
fix(trial balance party): add check for parties with zero credit and debit
(cherry picked from commit 83ddaf1696)
This commit is contained in:
@@ -81,5 +81,11 @@ frappe.query_reports["Trial Balance for Party"] = {
|
|||||||
label: __("Show zero values"),
|
label: __("Show zero values"),
|
||||||
fieldtype: "Check",
|
fieldtype: "Check",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
fieldname: "exclude_zero_balance_parties",
|
||||||
|
label: __("Exclude Zero Balance Parties"),
|
||||||
|
fieldtype: "Check",
|
||||||
|
default: 1,
|
||||||
|
},
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -75,20 +75,20 @@ def get_data(filters, show_party_name):
|
|||||||
closing_debit, closing_credit = toggle_debit_credit(opening_debit + debit, opening_credit + credit)
|
closing_debit, closing_credit = toggle_debit_credit(opening_debit + debit, opening_credit + credit)
|
||||||
row.update({"closing_debit": closing_debit, "closing_credit": closing_credit})
|
row.update({"closing_debit": closing_debit, "closing_credit": closing_credit})
|
||||||
|
|
||||||
# totals
|
|
||||||
for col in total_row:
|
|
||||||
total_row[col] += row.get(col)
|
|
||||||
|
|
||||||
row.update({"currency": company_currency})
|
row.update({"currency": company_currency})
|
||||||
|
|
||||||
has_value = False
|
has_value = False
|
||||||
if opening_debit or opening_credit or debit or credit or closing_debit or closing_credit:
|
if opening_debit or opening_credit or debit or credit or closing_debit or closing_credit:
|
||||||
has_value = True
|
has_value = True
|
||||||
|
# Exclude zero balance parties if filter is set
|
||||||
|
if filters.get("exclude_zero_balance_parties") and not closing_debit and not closing_credit:
|
||||||
|
continue
|
||||||
|
|
||||||
if cint(filters.show_zero_values) or has_value:
|
if cint(filters.show_zero_values) or has_value:
|
||||||
data.append(row)
|
data.append(row)
|
||||||
|
# totals
|
||||||
# Add total row
|
for col in total_row:
|
||||||
|
total_row[col] += row.get(col)
|
||||||
|
|
||||||
total_row.update({"party": "'" + _("Totals") + "'", "currency": company_currency})
|
total_row.update({"party": "'" + _("Totals") + "'", "currency": company_currency})
|
||||||
data.append(total_row)
|
data.append(total_row)
|
||||||
|
|||||||
Reference in New Issue
Block a user