Its a tricky question for me but an easy for the core team . I need to clarify how many items are available to my Stock.
To get the idea:
I need to have : Item 112-00001 available (not listed to other production line) current stock balance quantity for the item.
If you wish to have the Inventory Status before the Production to start, Please use the Production Planning tool and in that you will be able to get a Material requirement report for the item to be Manufactured.
Please refer the link below to learn more on the same.
Hope this helps.
@ArundhatiS Ty for your answer although isnt my usage case but you gave me the idea to search on the source of production tool to find my answer.
I am trying to have a concrete way to check item avaliability for validatin purposes in our many custom doctypes.
You can use
get_stock_balance function, to get stock qty on any date for a specific warehouse and item.
conditions += " and `tabBin`.item_code = %(item_code)s"
values["item_code"] = item_code
query = (
"""select sum(stock_value) from `tabBin`, `tabItem` where 1 = 1
and `tabItem`.name = `tabBin`.item_code and ifnull(`tabItem`.disabled, 0) = 0 %s"""
stock_value = frappe.db.sql(query, values)
def get_stock_value_on(warehouse=None, posting_date=None, item_code=None):
if not posting_date:
posting_date = nowdate()