fixes in patch
diff --git a/erpnext/patches/v5_0/update_item_desc_and_image.py b/erpnext/patches/v5_0/update_item_desc_and_image.py
index 456c505..371dd2f 100644
--- a/erpnext/patches/v5_0/update_item_desc_and_image.py
+++ b/erpnext/patches/v5_0/update_item_desc_and_image.py
@@ -2,19 +2,21 @@
 # License: GNU General Public License v3. See license.txt
 
 import frappe
+from frappe.website.utils import find_first_image
+import re
 
 def execute():
-	dt_list= {"Purchase Order Item","Supplier Quotation Item", "BOM", "Bom Explosion Item" , \
-	"Bom Item", "Opportunity Item" , "Quotation Item" , "Sales Order Item" , "Delivery Note Item" , \
-	"Material Request Item" , "Purchase Receipt Item" , "Stock Entry Detail"}
-	
+	dt_list= ["Purchase Order Item","Supplier Quotation Item", "BOM", "BOM Explosion Item" , \
+	"BOM Item", "Opportunity Item" , "Quotation Item" , "Sales Order Item" , "Delivery Note Item" , \
+	"Material Request Item" , "Purchase Receipt Item" , "Stock Entry Detail"]
 	for dt in dt_list:
 		names = frappe.db.sql("""select name, description from `tab{0}` doc where doc.description is not null""".format(dt),as_dict=1)
 		for d in names:
 			try:
 				data = d.description
-				image_url = data.split('<img src=')[1].split('" width=')[0]
-				desc = data.split('<td>')[1].split('</td>')[0]
+				image_url = find_first_image(data)
+				desc =  re.sub("\<img[^>]+\>", "", data)
+				
 				frappe.db.sql("""update `tab{0}` doc set doc.description = %s, doc.image = %s 
 					where doc.name = %s """.format(dt),(desc, image_url, d.name))
 			except:
diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js
index cea4d03..c8b028b 100644
--- a/erpnext/public/js/controllers/transaction.js
+++ b/erpnext/public/js/controllers/transaction.js
@@ -68,7 +68,6 @@
 
 	item_code: function(doc, cdt, cdn) {
 		var me = this;
-		var d = locals[cdt][cdn];
 		var item = frappe.get_doc(cdt, cdn);
 		if(item.item_code || item.barcode || item.serial_no) {
 			if(!this.validate_company_and_party()) {