Merge pull request #39093 from rmehta/rename-workspace

fix(minor): Rename "ERPNext Settings" to "Settings" and remove "ERPNeā€¦
diff --git a/erpnext/manufacturing/doctype/bom_explosion_item/bom_explosion_item.json b/erpnext/manufacturing/doctype/bom_explosion_item/bom_explosion_item.json
index c75ac32..27ecd57 100644
--- a/erpnext/manufacturing/doctype/bom_explosion_item/bom_explosion_item.json
+++ b/erpnext/manufacturing/doctype/bom_explosion_item/bom_explosion_item.json
@@ -37,7 +37,8 @@
    "oldfieldname": "item_code",
    "oldfieldtype": "Link",
    "options": "Item",
-   "read_only": 1
+   "read_only": 1,
+   "search_index": 1
   },
   {
    "fieldname": "item_name",
@@ -170,7 +171,7 @@
  "index_web_pages_for_search": 1,
  "istable": 1,
  "links": [],
- "modified": "2023-11-14 18:35:40.856895",
+ "modified": "2024-01-02 13:49:36.211586",
  "modified_by": "Administrator",
  "module": "Manufacturing",
  "name": "BOM Explosion Item",
diff --git a/erpnext/manufacturing/doctype/work_order/test_work_order.py b/erpnext/manufacturing/doctype/work_order/test_work_order.py
index 07c253b..aa5db57 100644
--- a/erpnext/manufacturing/doctype/work_order/test_work_order.py
+++ b/erpnext/manufacturing/doctype/work_order/test_work_order.py
@@ -921,11 +921,9 @@
 			"Test RM Item 2 for Scrap Item Test",
 		]
 
-		from_time = add_days(now(), -1)
 		job_cards = frappe.get_all(
 			"Job Card Time Log",
 			fields=["distinct parent as name", "docstatus"],
-			filters={"from_time": (">", from_time)},
 			order_by="creation asc",
 		)
 
diff --git a/erpnext/stock/doctype/item/item_list.js b/erpnext/stock/doctype/item/item_list.js
index 22d38e8..1b57102 100644
--- a/erpnext/stock/doctype/item/item_list.js
+++ b/erpnext/stock/doctype/item/item_list.js
@@ -1,6 +1,6 @@
 frappe.listview_settings['Item'] = {
 	add_fields: ["item_name", "stock_uom", "item_group", "image",
-		"has_variants", "end_of_life", "disabled"],
+		"has_variants", "end_of_life", "disabled", "variant_of"],
 	filters: [["disabled", "=", "0"]],
 
 	get_indicator: function(doc) {
diff --git a/erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py b/erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py
index 774e5c6..218406f 100644
--- a/erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py
+++ b/erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py
@@ -85,6 +85,7 @@
 	# end: auto-generated types
 
 	def validate(self):
+		self.reset_serial_batch_bundle()
 		self.set_batch_no()
 		self.validate_serial_and_batch_no()
 		self.validate_duplicate_serial_and_batch_no()
@@ -100,6 +101,15 @@
 		self.set_incoming_rate()
 		self.calculate_qty_and_amount()
 
+	def reset_serial_batch_bundle(self):
+		if self.is_new() and self.amended_from:
+			for field in ["is_cancelled", "is_rejected"]:
+				if self.get(field):
+					self.set(field, 0)
+
+			if self.voucher_detail_no:
+				self.voucher_detail_no = None
+
 	def set_batch_no(self):
 		if self.has_serial_no and self.has_batch_no:
 			serial_nos = [d.serial_no for d in self.entries if d.serial_no]
@@ -914,7 +924,11 @@
 
 
 def get_serial_batch_from_csv(item_code, file_path):
-	file_path = frappe.get_site_path() + file_path
+	if "private" in file_path:
+		file_path = frappe.get_site_path() + file_path
+	else:
+		file_path = frappe.get_site_path() + "/public" + file_path
+
 	serial_nos = []
 	batch_nos = []
 
diff --git a/erpnext/stock/doctype/serial_and_batch_bundle/test_serial_and_batch_bundle.py b/erpnext/stock/doctype/serial_and_batch_bundle/test_serial_and_batch_bundle.py
index 478cfa4..1975747 100644
--- a/erpnext/stock/doctype/serial_and_batch_bundle/test_serial_and_batch_bundle.py
+++ b/erpnext/stock/doctype/serial_and_batch_bundle/test_serial_and_batch_bundle.py
@@ -427,11 +427,12 @@
 		from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import make_purchase_receipt
 
 		item = make_item(
+			"Test Serial and Batch Bundle Company Item",
 			properties={
 				"has_serial_no": 1,
 				"serial_no_series": "TT-SER-VAL-.#####",
-			}
-		)
+			},
+		).name
 
 		pr = make_purchase_receipt(
 			item_code=item,
@@ -460,6 +461,26 @@
 		sn_doc = add_serial_batch_ledgers(entries, item_row, pr, "_Test Warehouse - _TC")
 		self.assertEqual(sn_doc.company, "_Test Company")
 
+	def test_auto_cancel_serial_and_batch(self):
+		item_code = make_item(
+			properties={"has_serial_no": 1, "serial_no_series": "ATC-TT-SER-VAL-.#####"}
+		).name
+
+		se = make_stock_entry(
+			item_code=item_code,
+			target="_Test Warehouse - _TC",
+			qty=5,
+			rate=500,
+		)
+
+		bundle = se.items[0].serial_and_batch_bundle
+		docstatus = frappe.db.get_value("Serial and Batch Bundle", bundle, "docstatus")
+		self.assertEqual(docstatus, 1)
+
+		se.cancel()
+		docstatus = frappe.db.get_value("Serial and Batch Bundle", bundle, "docstatus")
+		self.assertEqual(docstatus, 2)
+
 
 def get_batch_from_bundle(bundle):
 	from erpnext.stock.serial_batch_bundle import get_batch_nos
diff --git a/erpnext/stock/serial_batch_bundle.py b/erpnext/stock/serial_batch_bundle.py
index a1874b8..39df227 100644
--- a/erpnext/stock/serial_batch_bundle.py
+++ b/erpnext/stock/serial_batch_bundle.py
@@ -242,6 +242,12 @@
 		if self.item_details.has_batch_no == 1:
 			self.update_batch_qty()
 
+		if self.sle.is_cancelled and self.sle.serial_and_batch_bundle:
+			self.cancel_serial_and_batch_bundle()
+
+	def cancel_serial_and_batch_bundle(self):
+		frappe.get_cached_doc("Serial and Batch Bundle", self.sle.serial_and_batch_bundle).cancel()
+
 	def submit_serial_and_batch_bundle(self):
 		doc = frappe.get_doc("Serial and Batch Bundle", self.sle.serial_and_batch_bundle)
 		self.validate_actual_qty(doc)