fixed Test Cases
diff --git a/erpnext/stock/doctype/item/test_item.py b/erpnext/stock/doctype/item/test_item.py
index 8db2d2d..488bd05 100644
--- a/erpnext/stock/doctype/item/test_item.py
+++ b/erpnext/stock/doctype/item/test_item.py
@@ -106,4 +106,11 @@
variant.item_name = "_Test Variant Item-S"
variant.save()
+def make_item_variant():
+ if not frappe.db.exists("Item", "_Test Variant Item-S"):
+ variant = create_variant("_Test Variant Item", """{"Test Size": "Small"}""")
+ variant.item_code = "_Test Variant Item-S"
+ variant.item_name = "_Test Variant Item-S"
+ variant.save()
+
test_records = frappe.get_test_records('Item')
diff --git a/erpnext/stock/doctype/item_attribute/item_attribute.py b/erpnext/stock/doctype/item_attribute/item_attribute.py
index 8350bed..766668f 100644
--- a/erpnext/stock/doctype/item_attribute/item_attribute.py
+++ b/erpnext/stock/doctype/item_attribute/item_attribute.py
@@ -42,6 +42,6 @@
variant_attributes = frappe.db.sql("select DISTINCT attribute_value from `tabVariant Attribute` where attribute=%s", self.name)
if variant_attributes:
for d in variant_attributes:
- if d[0] not in attribute_values:
+ if d[0] and d[0] not in attribute_values:
frappe.throw(_("Attribute Value {0} cannot be removed from {1} as Item Variants \
exist with this Attribute.").format(d[0], self.name))
diff --git a/erpnext/stock/doctype/stock_entry/test_stock_entry.py b/erpnext/stock/doctype/stock_entry/test_stock_entry.py
index 29f2a21..174bc1a 100644
--- a/erpnext/stock/doctype/stock_entry/test_stock_entry.py
+++ b/erpnext/stock/doctype/stock_entry/test_stock_entry.py
@@ -64,8 +64,10 @@
self.assertEqual([[1, 20],[1, 30]], eval(sle.stock_queue))
frappe.db.set_default("allow_negative_stock", 0)
-
+
def test_auto_material_request(self):
+ from erpnext.stock.doctype.item.test_item import make_item_variant
+ make_item_variant()
self._test_auto_material_request("_Test Item")
def test_auto_material_request_for_variant(self):