Show only those items which are not selected

Hi @Dbone,

Thank you so much for your kind help and advice.

@tanveer,

try the following script

frappe.ui.form.on("Quotation", {
	refresh: function(frm) {
		cur_frm.fields_dict.items.grid.get_field("item_code").get_query = function(doc) {
			items = $.map( cur_frm.doc.items, function(item,idx) { return item.item_code } )
			added_items = items.join(",")
			return {
				filters: {
					"item_code": ["not in", added_items]
				}
			}
		}
	}
});
4 Likes

Just tested this on my setup. Works perfectly! What a fantastic script, Iā€™m going to use this on most of my forms.

1 Like