fix estimate search filtering

This commit is contained in:
Casey 2026-02-13 17:30:59 -06:00
parent 49617c39c4
commit cf577f3ac7

View File

@ -15,6 +15,13 @@ def get_estimate_table_data_v2(filters={}, sortings=[], page=1, page_size=10):
"""Get paginated estimate table data with filtering and sorting."""
print("DEBUG: Raw estimate options received:", filters, sortings, page, page_size)
filters, sortings, page, page_size = DbUtils.process_datatable_request(filters, sortings, page, page_size)
if filters.get("address"):
# change the key from address to custom_job_address
filters["custom_job_address"] = filters.pop("address")
filters["custom_job_address"] = ["like", f"%{filters['custom_job_address']['value']}%"]
if filters.get("customer"):
filters["actual_customer_name"] = ["like", f"%{filters.pop('customer')['value']}%"]
print("DEBUG: Processed estimate options - Filters:", filters, "Sortings:", sortings, "Page:", page, "Page Size:", page_size)
sortings = "modified desc" if not sortings else sortings
count = frappe.db.count("Quotation", filters=filters)
print(f"DEBUG: Number of estimates returned: {count}")