diff --git a/custom_ui/api/db/estimates.py b/custom_ui/api/db/estimates.py index d9873f6..36a5307 100644 --- a/custom_ui/api/db/estimates.py +++ b/custom_ui/api/db/estimates.py @@ -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}")