@mohitchechani and Friends I am learning, how best filter records can be populated based on server-side API response for filtered records on a similar link doc used in another doc type.
I found this, as most near to my search on the forum is Can not filter in Link Field - #2 by vinhnguyent090
I build API to push filtered records but not getting success as I am not clear on how to map query response. My JS code is here
frm.set_query('Project Milestone Status Update', function () {
return {
query: "bren_erp.api.pending_milestone_project",
"filters": {
"milestone": frm.doc.milestone
}
}
});
and server-side code returning the list of milestone masters based on the certain condition that should be clear
def pending_milestone_project(project_id):
try:
real_estate_project_detail = frappe.get_all("Real Estate Project",filters={"name":project_id},
fields=["name","project_name","creation"])
for row in real_estate_project_detail:
milestone_name = frappe.get_doc("Real Estate Project",row.name)
project_payment_schedule=[]
for project_payment_schedule_row in milestone_name.project_payment_schedule:
if not project_payment_schedule_row.completed:
project_payment_schedule.append(dict(
milestone_name = project_payment_schedule_row.milestone_name,
))
row["project_payment_schedule"] = project_payment_schedule
pending_milestone=real_estate_project_detail[0].project_payment_schedule
return pending_milestone
except Exception as e:
frappe.log_error(frappe.get_traceback())
gen_response(500,"Something Wrong. Please Try Again")
I am still a learner, so please help me , thanks in advance