[fix] honour the shopping cart setting when showing the stock and non-stock item (#13988)

This commit is contained in:
Manas Solanki 2018-05-14 14:30:30 +05:30 committed by Nabin Hait
parent 8646ed45bc
commit 661332dab5
2 changed files with 8 additions and 5 deletions

View File

@ -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"):

View File

@ -12,10 +12,12 @@
<div>&nbsp</div>
<div style='font-size: small; margin-bottom: 10px;'>&nbsp</div>
{% endif %}
{% if in_stock or not is_stock_item %}
<div style='color: green'> <i class='fa fa-check'></i> {{ _("In stock") }}</div>
{% else %}
<div style='color: red'> <i class='fa fa-close'></i> {{ _("Not in stock") }}</div>
{% if show_stock_qty %}
{% if in_stock %}
<div style='color: green'> <i class='fa fa-check'></i> {{ _("In stock") }}</div>
{% else %}
<div style='color: red'> <i class='fa fa-close'></i> {{ _("Not in stock") }}</div>
{% endif %}
{% endif %}
</div>
</div>