fix for the non stock items for the shopping cart (#12294)

This commit is contained in:
Manas Solanki 2018-01-05 12:47:20 +05:30 committed by Nabin Hait
parent 171157f1b3
commit a521efc990
5 changed files with 7 additions and 7 deletions

View File

@ -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

View File

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

View File

@ -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) {

View File

@ -5,7 +5,7 @@
<div class="product-image-img">
{{ product_image_square(thumbnail or website_image) }}
<div class="product-text" itemprop="name">{{ item_name }}</div>
{% if in_stock %}
{% 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>

View File

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