Skip to content

Commit

Permalink
fix: stock error for service item
Browse files Browse the repository at this point in the history
(cherry picked from commit 32965f1)
  • Loading branch information
rohitwaghchaure authored and mergify[bot] committed Jun 20, 2023
1 parent 95e3dc9 commit 2bbea63
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions erpnext/e_commerce/variant_selector/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ def get_next_attribute_and_values(item_code, selected_attributes):
product_info = get_item_variant_price_dict(exact_match[0], cart_settings)

if product_info:
product_info["is_stock_item"] = frappe.get_cached_value("Item", exact_match[0], "is_stock_item")
product_info["allow_items_not_in_stock"] = cint(cart_settings.allow_items_not_in_stock)
else:
product_info = None
Expand Down
6 changes: 4 additions & 2 deletions erpnext/templates/generators/item/item_configure.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,8 @@ class ItemConfigure {
: ''
}
${available_qty === 0 ? '<span class="text-danger">(' + __('Out of Stock') + ')</span>' : ''}
${available_qty === 0 && product_info && product_info?.is_stock_item
? '<span class="text-danger">(' + __('Out of Stock') + ')</span>' : ''}
</div></div>
<a href data-action="btn_clear_values" data-item-code="${one_item}">
Expand All @@ -236,7 +237,8 @@ class ItemConfigure {
</div>`;
/* eslint-disable indent */

if (!product_info?.allow_items_not_in_stock && available_qty === 0) {
if (!product_info?.allow_items_not_in_stock && available_qty === 0
&& product_info && product_info?.is_stock_item) {
item_add_to_cart = '';
}

Expand Down

0 comments on commit 2bbea63

Please sign in to comment.