ragav
October 14, 2016, 8:25am
1
Hi Guys ,
I read this post and got the below script and that works like a charm , but I have a issue
For some reason saving after editing the original post gives error.
Hi There,
We are trying to restrict values in Supplier Link field on Purchase Order page to certain values based on a filter using below custom script but it doesn’t seems to work. Please help.
frappe.ui.form.on("Purchase Order", "onload", function(frm) {
cur_frm.set_query("supplier", function() {
return {
"filters": {
"currency_pay_in": "USD"
}
};
});
});
We ha…
{
frappe.ui.form.on("VAVE", "refresh", function(frm,doc) {
cur_frm.set_query("treatment", function() {
return {
"filters": {
"item1": cur_frm.doc.job_order,
}
};
});});
}
My data job_order will be there in item1 field or it might be in item2 field ,also it could be in item3 field , so I want those docs which contain the job_order I entered in my doc to be visible in the link field . If I add one more line in the filter like this
“filters”: {
“item1”: cur_frm.doc.job_order,
“item2”: cur_frm.doc.job_order,
}
only those docs which contains the entered job_order in both the above fields are getting displayed.
Any help would be a life saver .
Thanks in advance
Edit :
To put it simply , rather than searching the data in a particular field in a doc , all the fields in the doc has to be searched for my data .
Please help
ragav
October 17, 2016, 4:30am
3
Please could anyone guide me ?
Thanks
rmehta
October 18, 2016, 12:43pm
4
Please state clearly and briefly, what have you tried and what is your problem. Remember that no one has your local setup to test.
@rmehta
Hi sir,
I look to implement Custom script on Start date to create event in Calendar.
Please can you tell me how.
manasan
February 7, 2021, 12:08pm
6
If I’ve understood you correctly, you would like to search for the same value in multiple fields. To achieve this, you can use or_filters
To expand on your example,
frappe.ui.form.on("VAVE", "refresh", function (frm, doc) {
cur_frm.set_query("treatment", function () {
return {
"or_filters": {
"item1": cur_frm.doc.job_order,
"item2": cur_frm.doc.job_order,
"item3": cur_frm.doc.job_order,
}
};
});
});