kenny
1
Hi Guys,
I need to limit the item to be created in the quotation.
E.G the user only able to select the L00001 from the list quotation item list.
I think i need to write the custom script but i the script i wrote is not work. Can someone help on this?
@kenny
if you want display some item .You can perform this by using get_query().
kenny
3
@jsukrut,
thanks for the reply.
but the get_query needed to be declared in âquotation itemâ doctype or âquotationâ doctype?
and is the coding below correct?
frappe.ui.form.on(âItemâ, âonloadâ, function(frm) {
cur_frm.get_query(âitemâ, function(){
return {
âfiltersâ: [
[âItemâ: âitem_codeâ, â=â, âL00001â]
]
}
});
});
appreciate your help y.
Change the DocType from Quotation Item to Quotation then try this:
frappe.ui.form.on("Quotation", "onload_post_render", function(frm) {
frm.fields_dict.items.grid.get_field("item_code").get_query = function() {
return {
filters: {
"item_code": "L00001"
}
}
}
});
1 Like
kenny
5
thanks @mibrahim. It works!. can ask one more question? how i add or in the filter?
filters: {
âitem_codeâ: âL00001â || âL00002â
}
is this correct?
@kenny
try this
filters: [
["Item", "item_code", "in", ["L00001","L00002"]],
]
OR
filters: {"name": ["in", ["L00001","L00002"]] }
2 Likes
kenny
7
@Sangram thanks. it work nicely