From 2db8dc922ac6b5a612ad862d7da94ba46c2ac595 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 29 Apr 2015 18:39:33 +0530 Subject: [PATCH] fixed trial balance related to showing zero balance --- erpnext/accounts/report/trial_balance/trial_balance.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/report/trial_balance/trial_balance.py b/erpnext/accounts/report/trial_balance/trial_balance.py index f062cdb63fb..761d038b127 100644 --- a/erpnext/accounts/report/trial_balance/trial_balance.py +++ b/erpnext/accounts/report/trial_balance/trial_balance.py @@ -123,7 +123,8 @@ def accumulate_values_into_parents(accounts, accounts_by_name): def prepare_data(accounts, filters, total_row): show_zero_values = cint(filters.show_zero_values) data = [] - for i, d in enumerate(accounts): + accounts_with_zero_value = [] + for d in accounts: has_value = False row = { "account_name": d.account_name, @@ -141,8 +142,13 @@ def prepare_data(accounts, filters, total_row): if row[key]: has_value = True - if has_value or show_zero_values: + if show_zero_values: data.append(row) + else: + if not has_value: + accounts_with_zero_value.append(d.name) + elif d.parent_account not in accounts_with_zero_value: + data.append(row) data.extend([{},total_row])