Test Cases Added to Production Order
diff --git a/erpnext/manufacturing/doctype/production_order/production_order.py b/erpnext/manufacturing/doctype/production_order/production_order.py
index 7a0921d..c2cbbfd 100644
--- a/erpnext/manufacturing/doctype/production_order/production_order.py
+++ b/erpnext/manufacturing/doctype/production_order/production_order.py
@@ -14,6 +14,8 @@
 class OverProductionError(frappe.ValidationError): pass
 class StockOverProductionError(frappe.ValidationError): pass
 class OperationTooLongError(frappe.ValidationError): pass
+class ProductionNotApplicableError(frappe.ValidationError): pass
+class ItemHasVariantError(frappe.ValidationError): pass
 
 from erpnext.manufacturing.doctype.workstation.workstation import WorkstationHolidayError, NotInWorkingHoursError
 from erpnext.projects.doctype.time_log.time_log import OverlapError
@@ -326,10 +328,10 @@
 	
 	def validate_production_item(self):
 		if frappe.db.get_value("Item", self.production_item, "is_pro_applicable")=='No':
-			frappe.throw(_("Item is not allowed to have Production Order."))
+			frappe.throw(_("Item is not allowed to have Production Order."), ProductionNotApplicableError)
 		
 		if frappe.db.get_value("Item", self.production_item, "has_variants"):
-			frappe.throw(_("Production Order cannot be raised against a Item Template"))
+			frappe.throw(_("Production Order cannot be raised against a Item Template"), ItemHasVariantError)
 		
 		validate_end_of_life(self.production_item)
 
diff --git a/erpnext/manufacturing/doctype/production_order/test_production_order.py b/erpnext/manufacturing/doctype/production_order/test_production_order.py
index f9aa031..c62be82 100644
--- a/erpnext/manufacturing/doctype/production_order/test_production_order.py
+++ b/erpnext/manufacturing/doctype/production_order/test_production_order.py
@@ -7,7 +7,8 @@
 import frappe
 from frappe.utils import flt, get_datetime, time_diff_in_hours
 from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import set_perpetual_inventory
-from erpnext.manufacturing.doctype.production_order.production_order import make_stock_entry, make_time_log
+from erpnext.manufacturing.doctype.production_order.production_order \
+	import make_stock_entry, make_time_log, ProductionNotApplicableError,ItemHasVariantError
 from erpnext.stock.doctype.stock_entry import test_stock_entry
 from erpnext.projects.doctype.time_log.time_log import OverProductionLoggedError
 
@@ -137,10 +138,24 @@
 		
 	def test_production_item(self):
 		item = frappe.get_doc("Item", "_Test FG Item")
-		item.end_of_life = 
+		item.is_pro_applicable= "No"
+		item.save()
 		
 		prod_order = make_prod_order_test_record(item="_Test FG Item", qty=1, do_not_save=True)
+		self.assertRaises(ProductionNotApplicableError, prod_order.save)
 		
+		item.is_pro_applicable= "Yes"
+		item.end_of_life = "2000-1-1"
+		item.save()
+		
+		self.assertRaises(frappe.ValidationError, prod_order.save)
+		
+		item.end_of_life=None
+		item.save()
+		
+		prod_order = make_prod_order_test_record(item="_Test Variant Item", qty=1, do_not_save=True)
+		self.assertRaises(ItemHasVariantError, prod_order.save)
+
 def make_prod_order_test_record(**args):
 	args = frappe._dict(args)