mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-31 18:59:08 +00:00
feat: account name and number columns on financial statements report on export (#48630)
* feat: account name and number columns on trial balance report on export * feat: account name and number columns on financial statement reports on export * test: fixed test_profit_and_loss_output_and_summary for new columns
This commit is contained in:
@@ -30,3 +30,5 @@ frappe.query_reports["Balance Sheet"]["filters"].push({
|
|||||||
fieldtype: "Check",
|
fieldtype: "Check",
|
||||||
default: 1,
|
default: 1,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
frappe.query_reports["Balance Sheet"]["export_hidden_cols"] = true;
|
||||||
|
|||||||
@@ -295,6 +295,8 @@ def prepare_data(accounts, balance_must_be, period_list, company_currency, accum
|
|||||||
"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)
|
||||||
),
|
),
|
||||||
|
"acc_name": d.account_name,
|
||||||
|
"acc_number": d.account_number,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
for period in period_list:
|
for period in period_list:
|
||||||
@@ -650,6 +652,25 @@ def get_columns(periodicity, period_list, accumulated_values=1, company=None, ca
|
|||||||
"width": 300,
|
"width": 300,
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
if not cash_flow:
|
||||||
|
columns.extend(
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"fieldname": "acc_name",
|
||||||
|
"label": _("Account Name"),
|
||||||
|
"fieldtype": "Data",
|
||||||
|
"width": 250,
|
||||||
|
"hidden": 1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "acc_number",
|
||||||
|
"label": _("Account Number"),
|
||||||
|
"fieldtype": "Data",
|
||||||
|
"width": 120,
|
||||||
|
"hidden": 1,
|
||||||
|
},
|
||||||
|
]
|
||||||
|
)
|
||||||
if company:
|
if company:
|
||||||
columns.append(
|
columns.append(
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -31,3 +31,5 @@ frappe.query_reports["Profit and Loss Statement"]["filters"].push({
|
|||||||
fieldtype: "Check",
|
fieldtype: "Check",
|
||||||
default: 1,
|
default: 1,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
frappe.query_reports["Profit and Loss Statement"]["export_hidden_cols"] = true;
|
||||||
|
|||||||
@@ -142,7 +142,7 @@ class TestProfitAndLossStatement(AccountsTestMixin, IntegrationTestCase):
|
|||||||
accumulated_values=False,
|
accumulated_values=False,
|
||||||
)
|
)
|
||||||
result = execute(filters)
|
result = execute(filters)
|
||||||
columns = [result[0][2], result[0][3]]
|
columns = [result[0][4], result[0][5]]
|
||||||
expected = {
|
expected = {
|
||||||
"account": income_acc,
|
"account": income_acc,
|
||||||
columns[0].get("fieldname"): 450.0,
|
columns[0].get("fieldname"): 450.0,
|
||||||
@@ -163,7 +163,7 @@ class TestProfitAndLossStatement(AccountsTestMixin, IntegrationTestCase):
|
|||||||
columns[1].get("fieldname"): 570.0,
|
columns[1].get("fieldname"): 570.0,
|
||||||
}
|
}
|
||||||
result = execute(filters)
|
result = execute(filters)
|
||||||
columns = [result[0][2], result[0][3]]
|
columns = [result[0][4], result[0][5]]
|
||||||
actual = [x for x in result[1] if x.get("account") == income_acc]
|
actual = [x for x in result[1] if x.get("account") == income_acc]
|
||||||
self.assertEqual(len(actual), 1)
|
self.assertEqual(len(actual), 1)
|
||||||
actual = actual[0]
|
actual = actual[0]
|
||||||
|
|||||||
@@ -122,6 +122,7 @@ frappe.query_reports["Trial Balance"] = {
|
|||||||
tree: true,
|
tree: true,
|
||||||
name_field: "account",
|
name_field: "account",
|
||||||
parent_field: "parent_account",
|
parent_field: "parent_account",
|
||||||
|
export_hidden_cols: true,
|
||||||
initial_depth: 3,
|
initial_depth: 3,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -402,6 +402,8 @@ def prepare_data(accounts, filters, parent_children_map, company_currency):
|
|||||||
"to_date": filters.to_date,
|
"to_date": filters.to_date,
|
||||||
"currency": company_currency,
|
"currency": company_currency,
|
||||||
"is_group_account": d.is_group,
|
"is_group_account": d.is_group,
|
||||||
|
"acc_name": d.account_name,
|
||||||
|
"acc_number": d.account_number,
|
||||||
"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
|
||||||
),
|
),
|
||||||
@@ -436,6 +438,20 @@ def get_columns():
|
|||||||
"options": "Account",
|
"options": "Account",
|
||||||
"width": 300,
|
"width": 300,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "acc_name",
|
||||||
|
"label": _("Account Name"),
|
||||||
|
"fieldtype": "Data",
|
||||||
|
"hidden": 1,
|
||||||
|
"width": 250,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "acc_number",
|
||||||
|
"label": _("Account Number"),
|
||||||
|
"fieldtype": "Data",
|
||||||
|
"hidden": 1,
|
||||||
|
"width": 120,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "currency",
|
"fieldname": "currency",
|
||||||
"label": _("Currency"),
|
"label": _("Currency"),
|
||||||
|
|||||||
Reference in New Issue
Block a user