fix: add include closed orders option in so/po trends report

This commit is contained in:
Nihantra Patel
2024-05-20 15:51:27 +05:30
parent be1fce2da6
commit eb4f94ddf2
3 changed files with 18 additions and 2 deletions

View File

@@ -2,3 +2,10 @@
// License: GNU General Public License v3. See license.txt
frappe.query_reports["Purchase Order Trends"] = $.extend({}, erpnext.purchase_trends_filters);
frappe.query_reports["Purchase Order Trends"]["filters"].push({
"fieldname": "include_closed_orders",
"label": __("Include Closed Orders"),
"fieldtype": "Check",
"default": 0
});

View File

@@ -74,8 +74,10 @@ def get_data(filters, conditions):
if conditions["based_on_select"] in ["t1.project,", "t2.project,"]:
cond = " and " + conditions["based_on_select"][:-1] + " IS Not NULL"
if conditions.get("trans") in ["Sales Order", "Purchase Order"]:
cond += " and t1.status != 'Closed'"
if not filters.get("include_closed_orders"):
if conditions.get("trans") in ["Sales Order", "Purchase Order"]:
cond += " and t1.status != 'Closed'"
if conditions.get("trans") == "Quotation" and filters.get("group_by") == "Customer":
cond += " and t1.quotation_to = 'Customer'"

View File

@@ -2,3 +2,10 @@
// License: GNU General Public License v3. See license.txt
frappe.query_reports["Sales Order Trends"] = $.extend({}, erpnext.sales_trends_filters);
frappe.query_reports["Sales Order Trends"]["filters"].push({
"fieldname": "include_closed_orders",
"label": __("Include Closed Orders"),
"fieldtype": "Check",
"default": 0
});