From e9d45bcb28033ddbe05c052c38d17b0df0443d25 Mon Sep 17 00:00:00 2001 From: Neil Trini Lasrado Date: Wed, 18 Feb 2015 20:01:27 +0530 Subject: [PATCH 1/2] patch fixes --- erpnext/manufacturing/doctype/bom/bom.json | 2 +- erpnext/patches.txt | 2 +- .../v5_0/update_item_desc_and_image.py | 21 ------------------- 3 files changed, 2 insertions(+), 23 deletions(-) delete mode 100644 erpnext/patches/v5_0/update_item_desc_and_image.py diff --git a/erpnext/manufacturing/doctype/bom/bom.json b/erpnext/manufacturing/doctype/bom/bom.json index 8866100cc5..78a800bd3a 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 8156c02189..1c366d2bb0 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -117,4 +117,4 @@ erpnext.patches.v5_0.new_crm_module 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_desc_and_image.py deleted file mode 100644 index 296ac0a5a1..0000000000 --- a/erpnext/patches/v5_0/update_item_desc_and_image.py +++ /dev/null @@ -1,21 +0,0 @@ -# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors -# 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"] - 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) - for d in names: - data = d.description - image_url = find_first_image(data) - desc = re.sub("\]+\>", "", data) - - frappe.db.sql("""update `tab{0}` set description = %s, image = %s - where name = %s """.format(dt),(desc, image_url, d.name)) From ae3f4f363fe8a6b935f2ccb532fd5aedea47e34e Mon Sep 17 00:00:00 2001 From: Neil Trini Lasrado Date: Wed, 18 Feb 2015 20:48:26 +0530 Subject: [PATCH 2/2] patch renamed --- .../v5_0/update_item_description_and_image.py | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 erpnext/patches/v5_0/update_item_description_and_image.py diff --git a/erpnext/patches/v5_0/update_item_description_and_image.py b/erpnext/patches/v5_0/update_item_description_and_image.py new file mode 100644 index 0000000000..0da42f2377 --- /dev/null +++ b/erpnext/patches/v5_0/update_item_description_and_image.py @@ -0,0 +1,22 @@ +# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors +# License: GNU General Public License v3. See license.txt + +import frappe +from frappe.website.utils import find_first_image +from frappe.utils import cstr +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"] + for dt in dt_list: + frappe.reload_doctype(dt) + 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 = cstr(d.description) + image_url = find_first_image(data) + desc = re.sub("\]+\>", "", data) + + frappe.db.sql("""update `tab{0}` set description = %s, image = %s + where name = %s """.format(dt), (desc, image_url, d.name))