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

(cherry picked from commit bb29fc4c3d)
This commit is contained in:
vishnu
2024-08-28 15:10:08 +00:00
committed by Mergify
parent ec00b2cf48
commit c87f2d2f7c

View File

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