fix: add validation for 'for_qty' else throws errors (#25829)

* fix: add validation for 'for_qty' else throws errors

* fix: check if for_qty is None

* fix: check purpose

* fix: add purpose to pick list get_doc

* fix: set as read only to prevent se from picking up value

Co-authored-by: Ankush <ankushmenat@gmail.com>

* chore: undo changes to doctype modified timestamp

Co-authored-by: Ankush <ankushmenat@gmail.com>
diff --git a/erpnext/stock/doctype/pick_list/pick_list.json b/erpnext/stock/doctype/pick_list/pick_list.json
index c01388d..2146793 100644
--- a/erpnext/stock/doctype/pick_list/pick_list.json
+++ b/erpnext/stock/doctype/pick_list/pick_list.json
@@ -184,4 +184,4 @@
  "sort_field": "modified",
  "sort_order": "DESC",
  "track_changes": 1
-}
\ No newline at end of file
+}
diff --git a/erpnext/stock/doctype/pick_list/pick_list.py b/erpnext/stock/doctype/pick_list/pick_list.py
index 6ab68e2..e795742 100644
--- a/erpnext/stock/doctype/pick_list/pick_list.py
+++ b/erpnext/stock/doctype/pick_list/pick_list.py
@@ -17,6 +17,9 @@
 # TODO: Prioritize SO or WO group warehouse
 
 class PickList(Document):
+	def validate(self):
+		self.validate_for_qty()
+
 	def before_save(self):
 		self.set_item_locations()
 
@@ -35,6 +38,7 @@
 
 	@frappe.whitelist()
 	def set_item_locations(self, save=False):
+		self.validate_for_qty()
 		items = self.aggregate_item_qty()
 		self.item_location_map = frappe._dict()
 
@@ -107,6 +111,11 @@
 
 		return item_map.values()
 
+	def validate_for_qty(self):
+		if self.purpose == "Material Transfer for Manufacture" \
+				and (self.for_qty is None or self.for_qty == 0):
+			frappe.throw(_("Qty of Finished Goods Item should be greater than 0."))
+
 
 def validate_item_locations(pick_list):
 	if not pick_list.locations:
diff --git a/erpnext/stock/doctype/pick_list/test_pick_list.py b/erpnext/stock/doctype/pick_list/test_pick_list.py
index c4da05a..84566b8 100644
--- a/erpnext/stock/doctype/pick_list/test_pick_list.py
+++ b/erpnext/stock/doctype/pick_list/test_pick_list.py
@@ -37,6 +37,7 @@
 			'company': '_Test Company',
 			'customer': '_Test Customer',
 			'items_based_on': 'Sales Order',
+			'purpose': 'Delivery',
 			'locations': [{
 				'item_code': '_Test Item',
 				'qty': 5,
@@ -90,6 +91,7 @@
 			'company': '_Test Company',
 			'customer': '_Test Customer',
 			'items_based_on': 'Sales Order',
+			'purpose': 'Delivery',
 			'locations': [{
 				'item_code': '_Test Item Warehouse Group Wise Reorder',
 				'qty': 1000,
@@ -135,6 +137,7 @@
 			'company': '_Test Company',
 			'customer': '_Test Customer',
 			'items_based_on': 'Sales Order',
+			'purpose': 'Delivery',
 			'locations': [{
 				'item_code': '_Test Serialized Item',
 				'qty': 1000,
@@ -264,6 +267,7 @@
 			'company': '_Test Company',
 			'customer': '_Test Customer',
 			'items_based_on': 'Sales Order',
+			'purpose': 'Delivery',
 			'locations': [{
 				'item_code': '_Test Item',
 				'qty': 5,
@@ -319,6 +323,7 @@
 			'company': '_Test Company',
 			'customer': '_Test Customer',
 			'items_based_on': 'Sales Order',
+			'purpose': 'Delivery',
 			'locations': [{
 				'item_code': '_Test Item',
 				'qty': 1,