fix: retain date filter when redirecting in Profit and Loss report

This commit is contained in:
vishnu
2024-08-28 15:10:08 +00:00
parent 5f3963b3e6
commit bb29fc4c3d

View File

@@ -114,16 +114,17 @@ erpnext.financial_statements = {
onload: function (report) {
// dropdown for links to other financial statements
erpnext.financial_statements.filters = get_filters();
var filters = report.get_values();
let fiscal_year = erpnext.utils.get_fiscal_year(frappe.datetime.get_today());
frappe.model.with_doc("Fiscal Year", fiscal_year, function (r) {
var fy = frappe.model.get_doc("Fiscal Year", fiscal_year);
frappe.query_report.set_filter_value({
period_start_date: fy.year_start_date,
period_end_date: fy.year_end_date,
if (!filters.period_start_date || !filters.period_end_date) {
frappe.model.with_doc("Fiscal Year", fiscal_year, function (r) {
var fy = frappe.model.get_doc("Fiscal Year", fiscal_year);
frappe.query_report.set_filter_value({
period_start_date: fy.year_start_date,
period_end_date: fy.year_end_date,
});
});
});
}
if (report.page) {
const views_menu = report.page.add_custom_button_group(__("Financial Statements"));