fix: set default_bom for item
diff --git a/erpnext/manufacturing/doctype/bom/bom.py b/erpnext/manufacturing/doctype/bom/bom.py
index 4c88eca..b29f671 100644
--- a/erpnext/manufacturing/doctype/bom/bom.py
+++ b/erpnext/manufacturing/doctype/bom/bom.py
@@ -445,6 +445,7 @@
 			and self.is_active
 		):
 			frappe.db.set(self, "is_default", 1)
+			frappe.db.set_value("Item", self.item, "default_bom", self.name)
 		else:
 			frappe.db.set(self, "is_default", 0)
 			item = frappe.get_doc("Item", self.item)
diff --git a/erpnext/manufacturing/doctype/bom/test_bom.py b/erpnext/manufacturing/doctype/bom/test_bom.py
index 182a20c..860512c 100644
--- a/erpnext/manufacturing/doctype/bom/test_bom.py
+++ b/erpnext/manufacturing/doctype/bom/test_bom.py
@@ -559,6 +559,42 @@
 		bom.submit()
 		self.assertEqual(bom.items[0].rate, 42)
 
+	def test_set_default_bom_for_item_having_single_bom(self):
+		from erpnext.stock.doctype.item.test_item import make_item
+
+		fg_item = make_item(properties={"is_stock_item": 1})
+		bom_item = make_item(properties={"is_stock_item": 1})
+
+		# Step 1: Create BOM
+		bom = frappe.new_doc("BOM")
+		bom.item = fg_item.item_code
+		bom.quantity = 1
+		bom.append(
+			"items",
+			{
+				"item_code": bom_item.item_code,
+				"qty": 1,
+				"uom": bom_item.stock_uom,
+				"stock_uom": bom_item.stock_uom,
+				"rate": 100.0,
+			},
+		)
+		bom.save()
+		bom.submit()
+		self.assertEqual(frappe.get_value("Item", fg_item.item_code, "default_bom"), bom.name)
+
+		# Step 2: Uncheck is_active field
+		bom.is_active = 0
+		bom.save()
+		bom.reload()
+		self.assertIsNone(frappe.get_value("Item", fg_item.item_code, "default_bom"))
+
+		# Step 3: Check is_active field
+		bom.is_active = 1
+		bom.save()
+		bom.reload()
+		self.assertEqual(frappe.get_value("Item", fg_item.item_code, "default_bom"), bom.name)
+
 
 def get_default_bom(item_code="_Test FG Item 2"):
 	return frappe.db.get_value("BOM", {"item": item_code, "is_active": 1, "is_default": 1})