I want to populate one of my forms dropdown by doing a sql query. I have created a custom_script with the following:
frappe.ui.form.on("Purchase Invoice", "onload_post_render", function(frm) {
cur_frm.set_df_property("return_against","read_only",false);
cur_frm.set_query("return_against", function() {
return {
query: "erpnext.stock.doctype.purchase_receipt.purchase_receipt.make_debit_note_query",
args: {"pr_number": cur_frm.purchase_receipt}
};
});
});
In the server side python script I want to do:
def make_debit_note_query(doctype, txt, searchfield, start, page_len, filters):
return frappe.db.sql("""select parent from `tabPurchase Invoice Item`
where purchase_receipt = '%s'""" % args.get('pr_number'))
The problem is my make_debit_note_query
cannot seem to see my args
dict. Can someone help me ?