From aa4f8cf4fcac0f7da62e9f50ccfd6b67f31ca705 Mon Sep 17 00:00:00 2001 From: Shivam Mishra Date: Thu, 6 Aug 2020 17:08:14 +0530 Subject: [PATCH] fix: handle product_info null --- erpnext/templates/generators/item/item_configure.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/erpnext/templates/generators/item/item_configure.js b/erpnext/templates/generators/item/item_configure.js index 163c955c56..284eb25218 100644 --- a/erpnext/templates/generators/item/item_configure.js +++ b/erpnext/templates/generators/item/item_configure.js @@ -194,9 +194,16 @@ class ItemConfigure { filtered_items[0] : ''; // Allow Add to Cart if adding out of stock items enabled in Shopping Cart else check stock. - const in_stock = product_info.allow_items_not_in_stock ? 1 : product_info.in_stock; - const add_to_cart = `${__('Add to cart')}`; - const product_action = in_stock ? add_to_cart : `${__('Not in Stock')}`; + var in_stock; + var add_to_cart; + var product_action; + if (product_info) { + in_stock = product_info.allow_items_not_in_stock ? 1 : product_info.in_stock; + add_to_cart = `${__('Add to cart')}`; + product_action = in_stock ? add_to_cart : `${__('Not in Stock')}`; + } else { + product_info = ''; + } const item_add_to_cart = one_item ? `