Skip to content

Commit

Permalink
feat: Show Zero Values filter in consolidated financial statement
Browse files Browse the repository at this point in the history
  • Loading branch information
deepeshgarg007 committed Nov 30, 2021
1 parent 38dfb60 commit 9610086
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@ frappe.require("assets/erpnext/js/financial_statements.js", function() {
"label": __("Include Default Book Entries"),
"fieldtype": "Check",
"default": 1
},
{
"fieldname": "show_zero_values",
"label": __("Show zero values"),
"fieldtype": "Check"
}
],
"formatter": function(value, row, column, data, default_formatter) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@
get_cash_flow_accounts,
)
from erpnext.accounts.report.cash_flow.cash_flow import get_report_summary as get_cash_flow_summary
from erpnext.accounts.report.financial_statements import get_fiscal_year_data, sort_accounts
from erpnext.accounts.report.financial_statements import (
filter_out_zero_value_rows,
get_fiscal_year_data,
sort_accounts,
)
from erpnext.accounts.report.profit_and_loss_statement.profit_and_loss_statement import (
get_chart_data as get_pl_chart_data,
)
Expand Down Expand Up @@ -265,7 +269,7 @@ def get_columns(companies, filters):
return columns

def get_data(companies, root_type, balance_must_be, fiscal_year, filters=None, ignore_closing_entries=False):
accounts, accounts_by_name = get_account_heads(root_type,
accounts, accounts_by_name, parent_children_map = get_account_heads(root_type,
companies, filters)

if not accounts: return []
Expand Down Expand Up @@ -294,6 +298,8 @@ def get_data(companies, root_type, balance_must_be, fiscal_year, filters=None, i

out = prepare_data(accounts, start_date, end_date, balance_must_be, companies, company_currency, filters)

out = filter_out_zero_value_rows(out, parent_children_map, show_zero_values=filters.get("show_zero_values"))

if out:
add_total_row(out, root_type, balance_must_be, companies, company_currency)

Expand Down Expand Up @@ -370,7 +376,7 @@ def get_account_heads(root_type, companies, filters):

accounts, accounts_by_name, parent_children_map = filter_accounts(accounts)

return accounts, accounts_by_name
return accounts, accounts_by_name, parent_children_map

def update_parent_account_names(accounts):
"""Update parent_account_name in accounts list.
Expand Down

0 comments on commit 9610086

Please sign in to comment.