Link Filter to show items under one Item group

In Quotation, I have made a child table ‘Quotation Carcass’ and I have used Link in ‘laminate_outside’ field to get items from the items master. I want only items under item group ‘laminate’ to show.

This is the field in Doctype ‘Quotation Carcass’

This is the child table in Quotation

I have tried some many of the solutions of other but it is not working

frappe.ui.form.on('Quotation Carcass', {
refresh: function(frm){
	frm.set_query("laminate_outside",function(){
		return{
			filters:{
				"item_group": ["=","laminate"]
			}
		}
	})
}
});

Add above code in custom script on Quotation Doctype, Should work

Docs for further information

https://frappeframework.com/docs/user/en/api/form#frmset_query

Thank you for the reply
Its not working


Am i doing something wrong in the field options?

frappe.ui.form.on('Quotation', {
refresh(frm) {
	frm.set_query('laminate_outside', 'fieldname_of_table_in_quotation_dt', () => {
        return {
            filters: {
                item_group: 'Laminate'
            }
        }
    })
}
})

This should work, I just tested it.

1 Like

It didn’t work

frappe.ui.form.on(‘Quotation’, {
refresh(frm) {
frm.set_query(‘laminate_outside’, ‘Quotation Carcass’, () => {
return {
filters: {
item_group: ‘Laminate’
}
}
})
}
})

Is it because of my workflow?
Traceback (most recent call last):
File “/home/frappe/benches/bench-version-13-f1-154/apps/frappe/frappe/model/workflow.py”, line 209, in bulk_workflow_approval
apply_workflow(frappe.get_doc(doctype, docname), action)
File “/home/frappe/benches/bench-version-13-f1-154/apps/frappe/frappe/model/workflow.py”, line 86, in apply_workflow
frappe.throw(_(“Not a valid Workflow Action”), WorkflowTransitionError)
File “/home/frappe/benches/bench-version-13-f1-154/apps/frappe/frappe/init.py”, line 409, in throw
msgprint(msg, raise_exception=exc, title=title, indicator=‘red’, is_minimizable=is_minimizable, wide=wide, as_list=as_list)
File “/home/frappe/benches/bench-version-13-f1-154/apps/frappe/frappe/init.py”, line 388, in msgprint
_raise_exception()
File “/home/frappe/benches/bench-version-13-f1-154/apps/frappe/frappe/init.py”, line 342, in _raise_exception
raise raise_exception(msg)
frappe.model.workflow.WorkflowTransitionError: Not a valid Workflow Action

use field name in the second argument not label or doctype name

1 Like

Thank you very much!!:grinning: