From 661332dab513cef692edfa18a929847d177259dd Mon Sep 17 00:00:00 2001 From: Manas Solanki Date: Mon, 14 May 2018 14:30:30 +0530 Subject: [PATCH] [fix] honour the shopping cart setting when showing the stock and non-stock item (#13988) --- erpnext/shopping_cart/product_info.py | 3 ++- erpnext/templates/includes/products_as_grid.html | 10 ++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/erpnext/shopping_cart/product_info.py b/erpnext/shopping_cart/product_info.py index 33cac17304..e62d633a67 100644 --- a/erpnext/shopping_cart/product_info.py +++ b/erpnext/shopping_cart/product_info.py @@ -33,7 +33,7 @@ def get_product_info_for_website(item_code): "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() if stock_status.is_stock_item else 0, + "show_stock_qty": show_quantity_in_website(), "sales_uom": frappe.db.get_value("Item", item_code, "sales_uom") } @@ -50,6 +50,7 @@ def set_product_info_for_website(item): product_info = get_product_info_for_website(item.item_code) if product_info: + item.update(product_info) item["stock_uom"] = product_info.get("uom") item["sales_uom"] = product_info.get("sales_uom") if product_info.get("price"): diff --git a/erpnext/templates/includes/products_as_grid.html b/erpnext/templates/includes/products_as_grid.html index 34c2ccda37..a057f5d6f2 100644 --- a/erpnext/templates/includes/products_as_grid.html +++ b/erpnext/templates/includes/products_as_grid.html @@ -12,10 +12,12 @@
 
 
{% endif %} - {% if in_stock or not is_stock_item %} -
{{ _("In stock") }}
- {% else %} -
{{ _("Not in stock") }}
+ {% if show_stock_qty %} + {% if in_stock %} +
{{ _("In stock") }}
+ {% else %} +
{{ _("Not in stock") }}
+ {% endif %} {% endif %}