Fetching Items in Search Result Based on Stock Availability

Hi,

How to fetch the item in the search bar in Item Child Table in Sales Invoice or Deliver Note based on the availability in the selected source warehouse? i.e. if the item has stock appear in the search result. if not, it doesn’t appear. How to do that using custom script?
image

Can someone help?