Getting an Item's current Stock Level

Hi, I’m writing a custom script that fetches an item and wanted to know what would be the way to go about getting the current units in stock available to.

I know that Sales Order Item has this feature, but couldn’t find a field in the Item’s DOCTYPE to match. Only the dashboard has current stock levels, but that (as far as I know) is not available to us for extract. as always, any help is greatly appreciated!

You can use erpnext.stock.utils.get_stock_balance method to get this.

I use erpnext.stock.utils.get_latest_stock_qty, passing item_code and warehouse. Another way is to retrieve the Bin record, also item_code and warehouse.

Mike

@Pawan and @Mike_Z, thanks!
But it seems to me that these are python utilities, I need to write a custom script (JS). Would there be an equivalent utility for JS?

ok, i found that this can also be called through API call. thanks!