mirror of
https://github.com/frappe/erpnext.git
synced 2026-02-14 02:04:17 +00:00
Co-authored-by: Diptanil Saha <diptanil@frappe.io>
This commit is contained in:
@@ -112,6 +112,12 @@ frappe.query_reports["Trial Balance"] = {
|
|||||||
fieldtype: "Check",
|
fieldtype: "Check",
|
||||||
default: 1,
|
default: 1,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
fieldname: "show_group_accounts",
|
||||||
|
label: __("Show Group Accounts"),
|
||||||
|
fieldtype: "Check",
|
||||||
|
default: 1,
|
||||||
|
},
|
||||||
],
|
],
|
||||||
formatter: erpnext.financial_statements.formatter,
|
formatter: erpnext.financial_statements.formatter,
|
||||||
tree: true,
|
tree: true,
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ def validate_filters(filters):
|
|||||||
|
|
||||||
def get_data(filters):
|
def get_data(filters):
|
||||||
accounts = frappe.db.sql(
|
accounts = frappe.db.sql(
|
||||||
"""select name, account_number, parent_account, account_name, root_type, report_type, lft, rgt
|
"""select name, account_number, parent_account, account_name, root_type, report_type, is_group, lft, rgt
|
||||||
|
|
||||||
from `tabAccount` where company=%s order by lft""",
|
from `tabAccount` where company=%s order by lft""",
|
||||||
filters.company,
|
filters.company,
|
||||||
@@ -393,6 +393,7 @@ def prepare_data(accounts, filters, parent_children_map, company_currency):
|
|||||||
"from_date": filters.from_date,
|
"from_date": filters.from_date,
|
||||||
"to_date": filters.to_date,
|
"to_date": filters.to_date,
|
||||||
"currency": company_currency,
|
"currency": company_currency,
|
||||||
|
"is_group_account": d.is_group,
|
||||||
"account_name": (
|
"account_name": (
|
||||||
f"{d.account_number} - {d.account_name}" if d.account_number else d.account_name
|
f"{d.account_number} - {d.account_name}" if d.account_number else d.account_name
|
||||||
),
|
),
|
||||||
@@ -409,6 +410,10 @@ def prepare_data(accounts, filters, parent_children_map, company_currency):
|
|||||||
data.append(row)
|
data.append(row)
|
||||||
|
|
||||||
total_row = calculate_total_row(accounts, company_currency)
|
total_row = calculate_total_row(accounts, company_currency)
|
||||||
|
|
||||||
|
if not filters.get("show_group_accounts"):
|
||||||
|
data = hide_group_accounts(data)
|
||||||
|
|
||||||
data.extend([{}, total_row])
|
data.extend([{}, total_row])
|
||||||
|
|
||||||
return data
|
return data
|
||||||
@@ -488,3 +493,12 @@ def prepare_opening_closing(row):
|
|||||||
row[valid_col] = 0.0
|
row[valid_col] = 0.0
|
||||||
else:
|
else:
|
||||||
row[reverse_col] = 0.0
|
row[reverse_col] = 0.0
|
||||||
|
|
||||||
|
|
||||||
|
def hide_group_accounts(data):
|
||||||
|
non_group_accounts_data = []
|
||||||
|
for d in data:
|
||||||
|
if not d.get("is_group_account"):
|
||||||
|
d.update(indent=0)
|
||||||
|
non_group_accounts_data.append(d)
|
||||||
|
return non_group_accounts_data
|
||||||
|
|||||||
Reference in New Issue
Block a user