brotherton-erpnext/patches/september_2013/p01_update_communication.py
2013-09-02 18:27:29 +05:30

15 lines
592 B
Python

import webnotes
def execute():
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, '')='' """)