fix: Default year start and end dates in reports
diff --git a/erpnext/public/js/purchase_trends_filters.js b/erpnext/public/js/purchase_trends_filters.js
index c786a86..77f1d2b 100644
--- a/erpnext/public/js/purchase_trends_filters.js
+++ b/erpnext/public/js/purchase_trends_filters.js
@@ -28,7 +28,7 @@
"label": __("Fiscal Year"),
"fieldtype": "Link",
"options":'Fiscal Year',
- "default": frappe.sys_defaults.fiscal_year
+ "default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today())
},
{
"fieldname":"period_based_on",
diff --git a/erpnext/public/js/sales_trends_filters.js b/erpnext/public/js/sales_trends_filters.js
index b9c4dca..b73747a 100644
--- a/erpnext/public/js/sales_trends_filters.js
+++ b/erpnext/public/js/sales_trends_filters.js
@@ -48,7 +48,7 @@
"label": __("Fiscal Year"),
"fieldtype": "Link",
"options":'Fiscal Year',
- "default": frappe.sys_defaults.fiscal_year
+ "default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today()),
},
{
"fieldname":"company",
diff --git a/erpnext/public/js/utils.js b/erpnext/public/js/utils.js
index cc03eca..d4f1991 100755
--- a/erpnext/public/js/utils.js
+++ b/erpnext/public/js/utils.js
@@ -400,7 +400,7 @@
});
},
- get_fiscal_year: function(date) {
+ get_fiscal_year: function(date, with_dates) {
if(!date) {
date = frappe.datetime.get_today();
}
@@ -414,7 +414,10 @@
async: false,
callback: function(r) {
if (r.message) {
- fiscal_year = r.message[0];
+ if (with_dates)
+ fiscal_year = r.message;
+ else
+ fiscal_year = r.message[0];
}
}
});