From 42e42b764727019171b7641203953c6370f13b52 Mon Sep 17 00:00:00 2001 From: Neil Trini Lasrado Date: Tue, 17 Feb 2015 17:41:07 +0530 Subject: [PATCH] fixes in patch --- erpnext/patches/v5_0/update_item_desc_and_image.py | 14 ++++++++------ erpnext/public/js/controllers/transaction.js | 1 - 2 files changed, 8 insertions(+), 7 deletions(-) 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 456c505eef..371dd2fd41 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('')[1].split('')[0] + image_url = find_first_image(data) + desc = re.sub("\]+\>", "", 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 cea4d03835..c8b028b12c 100644 --- a/erpnext/public/js/controllers/transaction.js +++ b/erpnext/public/js/controllers/transaction.js @@ -68,7 +68,6 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({ 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()) {