test: refactor BOM quality template test
diff --git a/erpnext/manufacturing/doctype/bom/bom.py b/erpnext/manufacturing/doctype/bom/bom.py
index d3acd5f..15fa67b 100644
--- a/erpnext/manufacturing/doctype/bom/bom.py
+++ b/erpnext/manufacturing/doctype/bom/bom.py
@@ -428,7 +428,7 @@
 
 	def clear_inspection(self):
 		if not self.inspection_required:
-			self.set('quality_inspection_template', None)
+			self.quality_inspection_template = None
 
 	def validate_main_item(self):
 		""" Validate main FG item"""
diff --git a/erpnext/manufacturing/doctype/bom/test_bom.py b/erpnext/manufacturing/doctype/bom/test_bom.py
index fe6cb0b..2f9b9de 100644
--- a/erpnext/manufacturing/doctype/bom/test_bom.py
+++ b/erpnext/manufacturing/doctype/bom/test_bom.py
@@ -6,7 +6,6 @@
 from functools import partial
 
 import frappe
-from frappe.test_runner import make_test_records
 from frappe.tests.utils import FrappeTestCase
 from frappe.utils import cstr, flt
 
@@ -20,15 +19,9 @@
 from erpnext.tests.test_subcontracting import set_backflush_based_on
 
 test_records = frappe.get_test_records('BOM')
+test_dependencies = ["Item", "Quality Inspection Template"]
 
 class TestBOM(FrappeTestCase):
-	def setUp(self):
-		if not frappe.get_value('Item', '_Test Item'):
-			make_test_records('Item')
-
-		if not frappe.get_value('Quality Inspection Template', '_Test Quality Inspection Template'):
-			make_test_records('Quality Inspection_Template')
-
 	def test_get_items(self):
 		from erpnext.manufacturing.doctype.bom.bom import get_bom_items_as_dict
 		items_dict = get_bom_items_as_dict(bom=get_default_bom(),
@@ -500,17 +493,19 @@
 
 	def test_clear_inpection_quality(self):
 
-		bom = frappe.copy_doc(test_records[2])
-		bom.is_active = 0
+		bom = frappe.copy_doc(test_records[2], ignore_no_copy=True)
+		bom.docstatus = 0
+		bom.is_default = 0
 		bom.quality_inspection_template = "_Test Quality Inspection Template"
 		bom.inspection_required = 1
 		bom.save()
+		bom.reload()
 
 		self.assertEqual(bom.quality_inspection_template, '_Test Quality Inspection Template')
 
 		bom.inspection_required = 0
 		bom.save()
-		bom.load_from_db()
+		bom.reload()
 
 		self.assertEqual(bom.quality_inspection_template, None)
 
diff --git a/erpnext/stock/doctype/quality_inspection_template/test_records.json b/erpnext/stock/doctype/quality_inspection_template/test_records.json
index a1b6415..980f49a 100644
--- a/erpnext/stock/doctype/quality_inspection_template/test_records.json
+++ b/erpnext/stock/doctype/quality_inspection_template/test_records.json
@@ -1,6 +1,7 @@
 [
  {
      "quality_inspection_template_name" : "_Test Quality Inspection Template",
+     "doctype": "Quality Inspection Template",
      "item_quality_inspection_parameter" : [
            {
             "specification": "_Test Param",