[minor] [patch] fixed old patch

This commit is contained in:
Anand Doshi 2013-09-12 17:43:38 +05:30
parent 94d62a8d9f
commit 31f1f005dd
2 changed files with 21 additions and 11 deletions

View File

@ -1,6 +1,7 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. # Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt # License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import webnotes import webnotes
from webnotes.utils import cint from webnotes.utils import cint
import MySQLdb import MySQLdb
@ -24,3 +25,5 @@ def execute():
except MySQLdb.OperationalError, e: except MySQLdb.OperationalError, e:
if e.args[0] == 1054: if e.args[0] == 1054:
webnotes.conn.sql("""update `tabItem Price` set buying_or_selling="Selling" """) webnotes.conn.sql("""update `tabItem Price` set buying_or_selling="Selling" """)
else:
raise e

View File

@ -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 webnotes
import MySQLdb
def execute(): 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"): for doctype in ("Contact", "Lead", "Job Applicant", "Supplier", "Customer", "Quotation", "Sales Person", "Support Ticket"):
fieldname = doctype.replace(" ", '_').lower() try:
webnotes.conn.sql("""update tabCommunication fieldname = doctype.replace(" ", '_').lower()
set parenttype=%s, parentfield='communications', webnotes.conn.sql("""update tabCommunication
parent=`%s` set parenttype=%s, parentfield='communications',
where ifnull(`%s`, '')!=''""" % ("%s", fieldname, fieldname), doctype) parent=`%s`
where ifnull(`%s`, '')!=''""" % ("%s", fieldname, fieldname), doctype)
webnotes.reload_doc("core", "doctype", "communication") except MySQLdb.OperationalError, e:
if e.args[0] != 1054:
webnotes.conn.sql("""update tabCommunication set communication_date = creation where raise e
ifnull(communication_date, '')='' """)