Client-side script for custom filter is not being applied to item_code field in Delivery Note items

I’m trying to create a custom filter for the item_code to be selected in a Delivery Note. However, the script is not getting triggered.

This is the code I’ve written.

frappe.ui.form.on('Delivery Note', {
    onload: function(frm, cdt, cdn) {
        frm.set_query('item_code', 'items', function(item_frm, item_dt, item_dn) {
            return {
                filters: [
                    ['item_name', '=', 'test'],

However, the ERPNext’s default filter is still applied on it, and my custom filter is not applied. It works fine on other fields but it specially doesn’t work on item_code field.