Need to filter Delivery note created


I have created a custom doctype allotment. Which will be created on submitting Sales Order document.
In allotment doctype i have a field called serial_no , i have added filter as below,

frappe.ui.form.on(‘Allotment’, {
refresh(frm) {
frm.set_query(“serial_no”, function(doc, dt, dn){
return {
filters: {
‘item_code’: doc.item_code,
‘delivery_document_type’: (doc.delivery_document_type !== “Delivery Note”)

I need to filter the serial nos of items which has no delivery note or delivery no, its not getting filtered

Thanks in advance!

It worked after giving below script,

frappe.ui.form.on(“Allotment”, “refresh”, function(frm){
frm.set_query(“serial_no”, function(doc){
return {
“filters”: [
[“Serial No”,“delivery_document_type”, “!=”, “Delivery Note”],
[“Serial No”,“item_code”,“=”,doc.item_code],