diff --git a/erpnext/setup/doctype/item_group/item_group.py b/erpnext/setup/doctype/item_group/item_group.py index 5d3ef78f1c8..39172d7d11b 100644 --- a/erpnext/setup/doctype/item_group/item_group.py +++ b/erpnext/setup/doctype/item_group/item_group.py @@ -82,7 +82,7 @@ def get_product_list_for_group(product_group=None, start=0, limit=10, search=Non # base query query = """select I.name, I.item_name, I.item_code, I.route, I.image, I.website_image, I.thumbnail, I.item_group, - I.description, I.web_long_description as website_description, + I.description, I.web_long_description as website_description, I.is_stock_item, case when (S.actual_qty - S.reserved_qty) > 0 then 1 else 0 end as in_stock from `tabItem` I left join tabBin S on I.item_code = S.item_code and I.website_warehouse = S.warehouse diff --git a/erpnext/shopping_cart/product_info.py b/erpnext/shopping_cart/product_info.py index 8015c4818f5..6f9c8acf170 100644 --- a/erpnext/shopping_cart/product_info.py +++ b/erpnext/shopping_cart/product_info.py @@ -30,10 +30,10 @@ def get_product_info_for_website(item_code): product_info = { "price": price, "stock_qty": stock_status.stock_qty, - "in_stock": stock_status.in_stock, + "in_stock": stock_status.in_stock if stock_status.is_stock_item else 1, "qty": 0, "uom": frappe.db.get_value("Item", item_code, "stock_uom"), - "show_stock_qty": show_quantity_in_website() + "show_stock_qty": show_quantity_in_website() if stock_status.is_stock_item else 0 } if product_info["price"]: diff --git a/erpnext/templates/includes/product_page.js b/erpnext/templates/includes/product_page.js index 93dadaa589e..9f9d6ac412a 100644 --- a/erpnext/templates/includes/product_page.js +++ b/erpnext/templates/includes/product_page.js @@ -64,7 +64,7 @@ frappe.ready(function() { // then chose the closest available one var attribute = $(this).attr("data-attribute"); - var attribute_value = $(this).val() + var attribute_value = $(this).val(); var item_code = find_closest_match(attribute, attribute_value); if (!item_code) { diff --git a/erpnext/templates/includes/products_as_grid.html b/erpnext/templates/includes/products_as_grid.html index b2437d3393f..4a9692aff62 100644 --- a/erpnext/templates/includes/products_as_grid.html +++ b/erpnext/templates/includes/products_as_grid.html @@ -5,7 +5,7 @@
{{ product_image_square(thumbnail or website_image) }}
{{ item_name }}
- {% if in_stock %} + {% if in_stock or not is_stock_item %}
{{ _("In stock") }}
{% else %}
{{ _("Not in stock") }}
diff --git a/erpnext/utilities/product.py b/erpnext/utilities/product.py index 10366be6ec4..9d5c056ba7e 100644 --- a/erpnext/utilities/product.py +++ b/erpnext/utilities/product.py @@ -9,7 +9,7 @@ from erpnext.accounts.doctype.pricing_rule.pricing_rule import get_pricing_rule_ def get_qty_in_stock(item_code, item_warehouse_field): in_stock, stock_qty = 0, '' - template_item_code = frappe.db.get_value("Item", item_code, "variant_of") + template_item_code, is_stock_item = frappe.db.get_value("Item", item_code, ["variant_of", "is_stock_item"]) warehouse = frappe.db.get_value("Item", item_code, item_warehouse_field) if not warehouse and template_item_code and template_item_code != item_code: @@ -21,7 +21,7 @@ def get_qty_in_stock(item_code, item_warehouse_field): if stock_qty: in_stock = stock_qty[0][0] > 0 and 1 or 0 - return frappe._dict({"in_stock": in_stock, "stock_qty": stock_qty}) + return frappe._dict({"in_stock": in_stock, "stock_qty": stock_qty, "is_stock_item": is_stock_item}) def get_price(item_code, price_list, customer_group, company, qty=1): template_item_code = frappe.db.get_value("Item", item_code, "variant_of")