fixed Test Cases
This commit is contained in:
parent
6cce304b27
commit
68f66a7e8b
@ -106,4 +106,11 @@ class TestItem(unittest.TestCase):
|
|||||||
variant.item_name = "_Test Variant Item-S"
|
variant.item_name = "_Test Variant Item-S"
|
||||||
variant.save()
|
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')
|
test_records = frappe.get_test_records('Item')
|
||||||
|
@ -42,6 +42,6 @@ class ItemAttribute(Document):
|
|||||||
variant_attributes = frappe.db.sql("select DISTINCT attribute_value from `tabVariant Attribute` where attribute=%s", self.name)
|
variant_attributes = frappe.db.sql("select DISTINCT attribute_value from `tabVariant Attribute` where attribute=%s", self.name)
|
||||||
if variant_attributes:
|
if variant_attributes:
|
||||||
for d in 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 \
|
frappe.throw(_("Attribute Value {0} cannot be removed from {1} as Item Variants \
|
||||||
exist with this Attribute.").format(d[0], self.name))
|
exist with this Attribute.").format(d[0], self.name))
|
||||||
|
@ -64,8 +64,10 @@ class TestStockEntry(unittest.TestCase):
|
|||||||
self.assertEqual([[1, 20],[1, 30]], eval(sle.stock_queue))
|
self.assertEqual([[1, 20],[1, 30]], eval(sle.stock_queue))
|
||||||
|
|
||||||
frappe.db.set_default("allow_negative_stock", 0)
|
frappe.db.set_default("allow_negative_stock", 0)
|
||||||
|
|
||||||
def test_auto_material_request(self):
|
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")
|
self._test_auto_material_request("_Test Item")
|
||||||
|
|
||||||
def test_auto_material_request_for_variant(self):
|
def test_auto_material_request_for_variant(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user