diff --git a/patches/june_2013/p03_buying_selling_for_price_list.py b/patches/june_2013/p03_buying_selling_for_price_list.py index c5a143511c..931517ea1a 100644 --- a/patches/june_2013/p03_buying_selling_for_price_list.py +++ b/patches/june_2013/p03_buying_selling_for_price_list.py @@ -1,6 +1,7 @@ # Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. # License: GNU General Public License v3. See license.txt +from __future__ import unicode_literals import webnotes from webnotes.utils import cint import MySQLdb @@ -24,3 +25,5 @@ def execute(): except MySQLdb.OperationalError, e: if e.args[0] == 1054: webnotes.conn.sql("""update `tabItem Price` set buying_or_selling="Selling" """) + else: + raise e diff --git a/patches/september_2013/p01_update_communication.py b/patches/september_2013/p01_update_communication.py index d840c801f9..31317384a2 100644 --- a/patches/september_2013/p01_update_communication.py +++ b/patches/september_2013/p01_update_communication.py @@ -1,15 +1,22 @@ +# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. +# License: GNU General Public License v3. See license.txt + +from __future__ import unicode_literals import webnotes +import MySQLdb def execute(): + webnotes.reload_doc("core", "doctype", "communication") + webnotes.conn.sql("""update tabCommunication set communication_date = creation where + ifnull(communication_date, '')='' """) + for doctype in ("Contact", "Lead", "Job Applicant", "Supplier", "Customer", "Quotation", "Sales Person", "Support Ticket"): - fieldname = doctype.replace(" ", '_').lower() - webnotes.conn.sql("""update tabCommunication - set parenttype=%s, parentfield='communications', - parent=`%s` - where ifnull(`%s`, '')!=''""" % ("%s", fieldname, fieldname), doctype) - - webnotes.reload_doc("core", "doctype", "communication") - - webnotes.conn.sql("""update tabCommunication set communication_date = creation where - ifnull(communication_date, '')='' """) - \ No newline at end of file + try: + fieldname = doctype.replace(" ", '_').lower() + webnotes.conn.sql("""update tabCommunication + set parenttype=%s, parentfield='communications', + parent=`%s` + where ifnull(`%s`, '')!=''""" % ("%s", fieldname, fieldname), doctype) + except MySQLdb.OperationalError, e: + if e.args[0] != 1054: + raise e