fixes in patch

This commit is contained in:
Neil Trini Lasrado 2015-02-17 17:41:07 +05:30
parent d98c4e007b
commit 42e42b7647
2 changed files with 8 additions and 7 deletions

View File

@ -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:

View File

@ -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()) {