feat: add status filter to Supplier Quotation Comparison report

This commit is contained in:
Shllokkk
2026-08-16 15:34:10 +05:30
parent 32ebd69abc
commit 2b84ed78e8
2 changed files with 19 additions and 1 deletions

View File

@@ -85,6 +85,17 @@ frappe.query_reports["Supplier Quotation Comparison"] = {
], ],
default: __("Categorize by Supplier"), default: __("Categorize by Supplier"),
}, },
{
fieldname: "status",
label: __("Status"),
fieldtype: "Select",
options: [
{ label: "", value: "" },
{ label: __("Draft"), value: "Draft" },
{ label: __("Submitted"), value: "Submitted" },
],
default: "Submitted",
},
{ {
fieldtype: "Check", fieldtype: "Check",
label: __("Include Expired"), label: __("Include Expired"),

View File

@@ -58,13 +58,20 @@ def get_data(filters):
) )
.where( .where(
(sq_item.parent == sq.name) (sq_item.parent == sq.name)
& (sq_item.docstatus < 2)
& (sq.company == filters.get("company")) & (sq.company == filters.get("company"))
& (sq.transaction_date.between(filters.get("from_date"), filters.get("to_date"))) & (sq.transaction_date.between(filters.get("from_date"), filters.get("to_date")))
) )
.orderby(sq.transaction_date, sq_item.item_code) .orderby(sq.transaction_date, sq_item.item_code)
) )
# blank -> Draft + Submitted, else filter to the chosen docstatus
if filters.get("status") == "Draft":
query = query.where(sq_item.docstatus == 0)
elif filters.get("status") == "Submitted":
query = query.where(sq_item.docstatus == 1)
else:
query = query.where(sq_item.docstatus < 2)
if filters.get("item_code"): if filters.get("item_code"):
query = query.where(sq_item.item_code == filters.get("item_code")) query = query.where(sq_item.item_code == filters.get("item_code"))