Showing Disabled Items in Link Field

I want to show the items which are disabled in my custom doctype’s link field.
How can i achieve this ?
Can anyone help me out ?

@NCP …??
Or else Can i know the functionality at where the functionality (disabled items are not shown in link fields) is implemented …??

Learn and explore this.

there are lots of references in forum so search it: Set_query problem! - #2 by NCP

@NCP Okay! Thank you!

@NCP By using this we can add filters! I added it and it is showing that filter also. But disabled items are not showing in the list. Please see the screenshots.

Make Disabled = 0 in the filter then It will work

@Usama_Naveed Then it will show the items which are not disabled.
But i want to show the items which are disabled.

Then your filter condition is ok

45563f584966307db09f150d3a9f737bb386b0ab_2_281x500

Are there any disabled items exist?

@Usama_Naveed Yes, see this.

You can’t remove it from the the Item Listview level. that for, you have to set the default filter using the listview client script or save filter feature.

@NCP Yes, I did like that only.
Filter is showing but the items are not showing in link field.
Infact im unable to select those items in any transaction.
But i want to show the disabled items in my custom doctype.

share the code, otherwise, check the references in forum

frappe.ui.form.on("Test", {
    onload: function(frm) {
        frm.set_query("item", function() {
            return {
                filters: {
                    "disabled": 1
                }
            };
        });
    }
});

@Kiranmai @NCP

Regarding Items Case, there is no need to put filter to show enabled item in doctype as well. It’s by default from system core code file.

Even, If you create a custom Doctype and child table. In the child table make a link field of item. Then you will able to see only enable item comes without Appling filter.

1 Like

@Usama_Naveed, I just wanted to see what he has written in the code, if they provides the code, we can reply, so that we don’t have to do such a long communication. :sweat_smile:

This required only one reply to solved the issue if provided the full details with code but we did 14 to 15 replies :joy:

1 Like

@NCP I already shared the code and scenario.

You have to see the list of disable items only then i have two suggestion for you
First
Create a button “Get Disabled Items” and table in doctype
on this button, call a python function by frappe.call

in the python function, run a query and get the disabled item as dict and return the dict

Then populate the dict into table of doctype

Second
Create a report and see the list of disabled items.