Fixed Test Cases
This commit is contained in:
parent
62dba50e9b
commit
9710eede00
@ -539,7 +539,8 @@ def create_variant(item, param):
|
|||||||
"attribute_value": args[d]
|
"attribute_value": args[d]
|
||||||
})
|
})
|
||||||
variant.set("attributes", variant_attributes)
|
variant.set("attributes", variant_attributes)
|
||||||
copy_attributes_to_variant(item, variant)
|
template = frappe.get_doc("Item", item)
|
||||||
|
copy_attributes_to_variant(template, variant)
|
||||||
return variant
|
return variant
|
||||||
|
|
||||||
def copy_attributes_to_variant(item, variant):
|
def copy_attributes_to_variant(item, variant):
|
||||||
|
|||||||
@ -6,7 +6,7 @@ import unittest
|
|||||||
import frappe
|
import frappe
|
||||||
|
|
||||||
from frappe.test_runner import make_test_records
|
from frappe.test_runner import make_test_records
|
||||||
from erpnext.stock.doctype.item.item import WarehouseNotSet, ItemTemplateCannotHaveStock
|
from erpnext.stock.doctype.item.item import WarehouseNotSet, ItemTemplateCannotHaveStock, create_variant
|
||||||
from erpnext.stock.doctype.stock_entry.test_stock_entry import make_stock_entry
|
from erpnext.stock.doctype.stock_entry.test_stock_entry import make_stock_entry
|
||||||
|
|
||||||
test_ignore = ["BOM"]
|
test_ignore = ["BOM"]
|
||||||
@ -99,4 +99,11 @@ class TestItem(unittest.TestCase):
|
|||||||
for key, value in to_check.iteritems():
|
for key, value in to_check.iteritems():
|
||||||
self.assertEquals(value, details.get(key))
|
self.assertEquals(value, details.get(key))
|
||||||
|
|
||||||
|
def test_make_item_variant(self):
|
||||||
|
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')
|
||||||
|
|||||||
@ -273,6 +273,11 @@
|
|||||||
"item_name": "_Test Variant Item",
|
"item_name": "_Test Variant Item",
|
||||||
"stock_uom": "_Test UOM",
|
"stock_uom": "_Test UOM",
|
||||||
"has_variants": 1,
|
"has_variants": 1,
|
||||||
|
"attributes": [
|
||||||
|
{
|
||||||
|
"attribute": "Test Size"
|
||||||
|
}
|
||||||
|
],
|
||||||
"apply_warehouse_wise_reorder_level": 1,
|
"apply_warehouse_wise_reorder_level": 1,
|
||||||
"reorder_levels": [
|
"reorder_levels": [
|
||||||
{
|
{
|
||||||
|
|||||||
@ -68,6 +68,9 @@ class TestStockEntry(unittest.TestCase):
|
|||||||
def test_auto_material_request(self):
|
def test_auto_material_request(self):
|
||||||
self._test_auto_material_request("_Test Item")
|
self._test_auto_material_request("_Test Item")
|
||||||
|
|
||||||
|
def test_auto_material_request_for_variant(self):
|
||||||
|
self._test_auto_material_request("_Test Variant Item-S")
|
||||||
|
|
||||||
def _test_auto_material_request(self, item_code):
|
def _test_auto_material_request(self, item_code):
|
||||||
item = frappe.get_doc("Item", item_code)
|
item = frappe.get_doc("Item", item_code)
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user