Skip to content

Commit

Permalink
fix: retain date filter when redirecting in Profit and Loss report
Browse files Browse the repository at this point in the history
(cherry picked from commit bb29fc4)
  • Loading branch information
vishnu authored and mergify[bot] committed Sep 3, 2024
1 parent ec00b2c commit c87f2d2
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions erpnext/public/js/financial_statements.js
Original file line number Diff line number Diff line change
Expand Up @@ -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"));

Expand Down

0 comments on commit c87f2d2

Please sign in to comment.