Merge pull request #2785 from neilLasrado/kill-html-desc

patch fixes
diff --git a/erpnext/manufacturing/doctype/bom/bom.json b/erpnext/manufacturing/doctype/bom/bom.json
index 8866100..78a800b 100644
--- a/erpnext/manufacturing/doctype/bom/bom.json
+++ b/erpnext/manufacturing/doctype/bom/bom.json
@@ -279,7 +279,7 @@
  "is_submittable": 1, 
  "issingle": 0, 
  "istable": 0, 
- "modified": "2015-02-13 14:58:32.967368", 
+ "modified": "2015-02-18 14:58:32.967368", 
  "modified_by": "Administrator", 
  "module": "Manufacturing", 
  "name": "BOM", 
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index 8156c02..1c366d2 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -117,4 +117,4 @@
 erpnext.patches.v5_0.rename_customer_issue
 erpnext.patches.v5_0.update_material_transfer_for_manufacture
 erpnext.patches.v5_0.manufacturing_activity_type
-erpnext.patches.v5_0.update_item_desc_and_image
+erpnext.patches.v5_0.update_item_description_and_image
diff --git a/erpnext/patches/v5_0/update_item_desc_and_image.py b/erpnext/patches/v5_0/update_item_description_and_image.py
similarity index 80%
rename from erpnext/patches/v5_0/update_item_desc_and_image.py
rename to erpnext/patches/v5_0/update_item_description_and_image.py
index 296ac0a..0da42f2 100644
--- a/erpnext/patches/v5_0/update_item_desc_and_image.py
+++ b/erpnext/patches/v5_0/update_item_description_and_image.py
@@ -3,6 +3,7 @@
 
 import frappe
 from frappe.website.utils import find_first_image
+from frappe.utils import cstr
 import re
 
 def execute():
@@ -11,11 +12,11 @@
 	"Material Request Item" , "Purchase Receipt Item" , "Stock Entry Detail"]
 	for dt in dt_list:
 		frappe.reload_doctype(dt)
-		names = frappe.db.sql("""select name, description from `tab{0}` doc where doc.description is not null""".format(dt),as_dict=1)
+		names = frappe.db.sql("""select name, description from `tab{0}` where description is not null""".format(dt),as_dict=1)
 		for d in names:
-			data = d.description
+			data = cstr(d.description)
 			image_url = find_first_image(data)
 			desc =  re.sub("\<img[^>]+\>", "", data)
 
 			frappe.db.sql("""update `tab{0}` set description = %s, image = %s
-				where name = %s """.format(dt),(desc, image_url, d.name))
+				where name = %s """.format(dt), (desc, image_url, d.name))