fix: Print/PDF for financial statement reports displays either wrong date range or wrong fiscal year

This commit is contained in:
vishdha 2022-06-03 14:23:53 +05:30 committed by Vishal Dhayagude
parent c66c1e2215
commit 3513d54c0a

View File

@ -50,7 +50,15 @@ frappe.require("assets/erpnext/js/financial_statements.js", function() {
"fieldtype": "Link",
"options": "Fiscal Year",
"default": frappe.defaults.get_user_default("fiscal_year"),
"reqd": 1
"reqd": 1,
on_change: () => {
frappe.model.with_doc("Fiscal Year", frappe.query_report.get_filter_value('from_fiscal_year'), function(r) {
let start_fy = frappe.model.get_doc("Fiscal Year", frappe.query_report.get_filter_value('from_fiscal_year'));
frappe.query_report.set_filter_value({
period_start_date: start_fy.year_start_date
});
});
}
},
{
"fieldname":"to_fiscal_year",
@ -58,7 +66,15 @@ frappe.require("assets/erpnext/js/financial_statements.js", function() {
"fieldtype": "Link",
"options": "Fiscal Year",
"default": frappe.defaults.get_user_default("fiscal_year"),
"reqd": 1
"reqd": 1,
on_change: () => {
frappe.model.with_doc("Fiscal Year", frappe.query_report.get_filter_value('to_fiscal_year'), function(r) {
let to_fy = frappe.model.get_doc("Fiscal Year", frappe.query_report.get_filter_value('to_fiscal_year'));
frappe.query_report.set_filter_value({
period_end_date: to_fy.year_end_date
});
});
}
},
{
"fieldname":"finance_book",