fix: Filters in trend reports
diff --git a/erpnext/accounts/report/purchase_invoice_trends/purchase_invoice_trends.js b/erpnext/accounts/report/purchase_invoice_trends/purchase_invoice_trends.js
index e3f90f2..0e84f88 100644
--- a/erpnext/accounts/report/purchase_invoice_trends/purchase_invoice_trends.js
+++ b/erpnext/accounts/report/purchase_invoice_trends/purchase_invoice_trends.js
@@ -1,8 +1,4 @@
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
// License: GNU General Public License v3. See license.txt
-frappe.require("assets/erpnext/js/purchase_trends_filters.js", function () {
- frappe.query_reports["Purchase Invoice Trends"] = {
- filters: erpnext.get_purchase_trends_filters(),
- };
-});
+frappe.query_reports["Purchase Invoice Trends"] = $.extend({}, erpnext.purchase_trends_filters);
diff --git a/erpnext/accounts/report/sales_invoice_trends/sales_invoice_trends.js b/erpnext/accounts/report/sales_invoice_trends/sales_invoice_trends.js
index 292d827..bdc39f3 100644
--- a/erpnext/accounts/report/sales_invoice_trends/sales_invoice_trends.js
+++ b/erpnext/accounts/report/sales_invoice_trends/sales_invoice_trends.js
@@ -1,8 +1,4 @@
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
// License: GNU General Public License v3. See license.txt
-frappe.require("assets/erpnext/js/sales_trends_filters.js", function () {
- frappe.query_reports["Sales Invoice Trends"] = {
- filters: erpnext.get_sales_trends_filters(),
- };
-});
+frappe.query_reports["Sales Invoice Trends"] = $.extend({}, erpnext.sales_trends_filters);
diff --git a/erpnext/buying/report/purchase_order_trends/purchase_order_trends.js b/erpnext/buying/report/purchase_order_trends/purchase_order_trends.js
index 366fff1..56684a8 100644
--- a/erpnext/buying/report/purchase_order_trends/purchase_order_trends.js
+++ b/erpnext/buying/report/purchase_order_trends/purchase_order_trends.js
@@ -1,8 +1,4 @@
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
// License: GNU General Public License v3. See license.txt
-frappe.require("assets/erpnext/js/purchase_trends_filters.js", function () {
- frappe.query_reports["Purchase Order Trends"] = {
- filters: erpnext.get_purchase_trends_filters(),
- };
-});
+frappe.query_reports["Purchase Order Trends"] = $.extend({}, erpnext.purchase_trends_filters);
diff --git a/erpnext/public/js/erpnext.bundle.js b/erpnext/public/js/erpnext.bundle.js
index b75a21b..9dd6f24 100644
--- a/erpnext/public/js/erpnext.bundle.js
+++ b/erpnext/public/js/erpnext.bundle.js
@@ -33,5 +33,7 @@
import "./controllers/buying.js";
import "./utils/demo.js";
import "./financial_statements.js";
+import "./sales_trends_filters.js";
+import "./purchase_trends_filters.js";
// import { sum } from 'frappe/public/utils/util.js'
diff --git a/erpnext/public/js/purchase_trends_filters.js b/erpnext/public/js/purchase_trends_filters.js
index 14ffaf8..75428d3 100644
--- a/erpnext/public/js/purchase_trends_filters.js
+++ b/erpnext/public/js/purchase_trends_filters.js
@@ -1,8 +1,8 @@
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
// License: GNU General Public License v3. See license.txt
-erpnext.get_purchase_trends_filters = function () {
- return [
+erpnext.purchase_trends_filters = {
+ filters: [
{
fieldname: "company",
label: __("Company"),
@@ -63,5 +63,5 @@
options: ["", { value: "Item", label: __("Item") }, { value: "Supplier", label: __("Supplier") }],
default: "",
},
- ];
+ ],
};
diff --git a/erpnext/public/js/sales_trends_filters.js b/erpnext/public/js/sales_trends_filters.js
index 85daa01..9b66f37 100644
--- a/erpnext/public/js/sales_trends_filters.js
+++ b/erpnext/public/js/sales_trends_filters.js
@@ -1,8 +1,8 @@
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
// License: GNU General Public License v3. See license.txt
-erpnext.get_sales_trends_filters = function () {
- return [
+erpnext.sales_trends_filters = {
+ filters: [
{
fieldname: "period",
label: __("Period"),
@@ -44,7 +44,7 @@
label: __("Fiscal Year"),
fieldtype: "Link",
options: "Fiscal Year",
- default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today()),
+ default: "2023-2024",
},
{
fieldname: "company",
@@ -53,5 +53,5 @@
options: "Company",
default: frappe.defaults.get_user_default("Company"),
},
- ];
+ ],
};
diff --git a/erpnext/selling/report/quotation_trends/quotation_trends.js b/erpnext/selling/report/quotation_trends/quotation_trends.js
index 8ffeda4..ff0b308 100644
--- a/erpnext/selling/report/quotation_trends/quotation_trends.js
+++ b/erpnext/selling/report/quotation_trends/quotation_trends.js
@@ -1,8 +1,4 @@
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
// License: GNU General Public License v3. See license.txt
-frappe.require("assets/erpnext/js/sales_trends_filters.js", function () {
- frappe.query_reports["Quotation Trends"] = {
- filters: erpnext.get_sales_trends_filters(),
- };
-});
+frappe.query_reports["Quotation Trends"] = $.extend({}, erpnext.sales_trends_filters);
diff --git a/erpnext/selling/report/sales_order_trends/sales_order_trends.js b/erpnext/selling/report/sales_order_trends/sales_order_trends.js
index fe38804..28bd550 100644
--- a/erpnext/selling/report/sales_order_trends/sales_order_trends.js
+++ b/erpnext/selling/report/sales_order_trends/sales_order_trends.js
@@ -1,8 +1,4 @@
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
// License: GNU General Public License v3. See license.txt
-frappe.require("assets/erpnext/js/sales_trends_filters.js", function () {
- frappe.query_reports["Sales Order Trends"] = {
- filters: erpnext.get_sales_trends_filters(),
- };
-});
+frappe.query_reports["Sales Order Trends"] = $.extend({}, erpnext.sales_trends_filters);
diff --git a/erpnext/stock/report/delivery_note_trends/delivery_note_trends.js b/erpnext/stock/report/delivery_note_trends/delivery_note_trends.js
index 5e7dc8b..67cf0ca 100644
--- a/erpnext/stock/report/delivery_note_trends/delivery_note_trends.js
+++ b/erpnext/stock/report/delivery_note_trends/delivery_note_trends.js
@@ -1,8 +1,4 @@
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
// License: GNU General Public License v3. See license.txt
-frappe.require("assets/erpnext/js/sales_trends_filters.js", function () {
- frappe.query_reports["Delivery Note Trends"] = {
- filters: erpnext.get_sales_trends_filters(),
- };
-});
+frappe.query_reports["Delivery Note Trends"] = $.extend({}, erpnext.sales_trends_filters);
diff --git a/erpnext/stock/report/purchase_receipt_trends/purchase_receipt_trends.js b/erpnext/stock/report/purchase_receipt_trends/purchase_receipt_trends.js
index bddfe5d..8a293e6 100644
--- a/erpnext/stock/report/purchase_receipt_trends/purchase_receipt_trends.js
+++ b/erpnext/stock/report/purchase_receipt_trends/purchase_receipt_trends.js
@@ -1,8 +1,4 @@
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
// License: GNU General Public License v3. See license.txt
-frappe.require("assets/erpnext/js/purchase_trends_filters.js", function () {
- frappe.query_reports["Purchase Receipt Trends"] = {
- filters: erpnext.get_purchase_trends_filters(),
- };
-});
+frappe.query_reports["Purchase Receipt Trends"] = $.extend({}, erpnext.purchase_trends_filters);