Remove all those parent items from packing details which are no longer present in main item table
diff --git a/erpnext/selling/doctype/sales_common/sales_common.py b/erpnext/selling/doctype/sales_common/sales_common.py
index 0a038b1..4817bdc 100644
--- a/erpnext/selling/doctype/sales_common/sales_common.py
+++ b/erpnext/selling/doctype/sales_common/sales_common.py
@@ -432,6 +432,7 @@
 	# ------------------ 
 	def make_packing_list(self, obj, fname):
 		self.packing_list_idx = 0
+		parent_items = []
 		for d in getlist(obj.doclist, fname):
 			warehouse = fname == "sales_order_details" and d.reserved_warehouse or d.warehouse
 			if self.has_sales_bom(d.item_code):
@@ -439,6 +440,16 @@
 					self.update_packing_list_item(obj, i['item_code'], flt(i['qty'])*flt(d.qty), warehouse, d)
 			else:
 				self.update_packing_list_item(obj, d.item_code, d.qty, warehouse, d)
+			if d.item_code not in parent_items:
+				parent_items.append(d.item_code)
+				
+		self.cleanup_packing_list(obj, parent_items)
+		
+	def cleanup_packing_list(self, obj, parent_items):
+		"""Remove all those parent items which are no longer present in main item table"""
+		for d in getlist(obj.doclist, 'packing_details'):
+			if d.parent_item not in parent_items:
+				d.parent = ''
 
 
 	# Get total in words