fix: Product Page non-stock item status (#20383)

This commit is contained in:
Marica
2020-01-24 15:52:27 +05:30
committed by Nabin Hait
parent 72c3dd1d11
commit 40dffab79e
2 changed files with 10 additions and 2 deletions

View File

@@ -124,3 +124,11 @@ def get_price(item_code, price_list, customer_group, company, qty=1):
price_obj["formatted_price"] = ""
return price_obj
def get_non_stock_item_status(item_code, item_warehouse_field):
#if item belongs to product bundle, check if bundle items are in stock
if frappe.db.exists("Product Bundle", item_code):
items = frappe.get_doc("Product Bundle", item_code).get_all_children()
return all([ get_qty_in_stock(d.item_code, item_warehouse_field).in_stock for d in items ])
else:
return 1