Quotation Creation : Select Item Group follow by select Item

I have added about 100 of Items and when creating a Quotation, I would like to select the Item Group follow by Item to narrow down the time to search for the Item. I have added a custom field namely Item Group in Quotation Form and now I can select from the list of Item Group but the Item selection list still display all Item from all Item Group. Please advise.

Hi @sctong147

I guess the best way forward would be to make the item code field depend on Item Group. This ways when a person selects an item group then only the item code would show up ensuring that the people in your company select an item group first.

As far as showing only items in the item groups is concerned you would have to write a custom script on the client side as below, kindly note that this is the code that I am using for my item master which can be reused in your Quotations as well with some modifications.

cur_frm.fields_dict['quality'].get_query = function(doc) {
doc = cur_frm.doc;
var cond = '';

if(doc.base_material!="" && doc.is_rm!=""){
	cond = '`tabQuality`.base_material = "'+doc.base_material+
		'" and `tabQuality`.is_rm = "'+doc.is_rm+'" and' ;
else if (doc.is_rm == "" && doc.base_material != ""){
	cond = '`tabQuality`.base_material = "'+doc.base_material+
		'" and `tabQuality`.is_rm = "No" and' ;
else if (doc.is_rm != "" && doc.base_material == ""){
	cond = '`tabQuality`.is_rm = "'+doc.is_rm+'" and' ;

return repl('SELECT DISTINCT `tabQuality`.`name`, base_material, is_rm, code \
	FROM `tabQuality` WHERE %(cond)s `tabQuality`.%(key)s LIKE "%s" \
	ORDER BY `tabQuality`.`name` DESC LIMIT 50', 
1 Like

Thanks @adityaduggal, I am new to this software. May you enlighten me more info or details about the coding?

Thank you.


Check this:



Thanks @rmehta I am not a developer, where should I start at to do the custom script?

You can add a custom script from

Setup > Customize > Custom Script

Also best to engage a freelancer / developer to get your customization setup quickly.