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,16 +113,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,
});
});
});
}
const views_menu = report.page.add_custom_button_group(__("Financial Statements"));