updated rename_dt

This commit is contained in:
Nabin Hait 2012-03-28 16:19:01 +05:30
parent 6370ba8280
commit 79bc01e33d

View File

@ -90,18 +90,17 @@ def rename_in_db(ren_data, data_type, is_doctype):
def update_dt_in_records(rendt):
for d in rendt:
# Feed, property setter, search criteria, gl mapper, form 16A, naming series options, doclayer - dodtype is not mentioed in options
dt_list = webnotes.conn.sql("select parent, fieldname from tabDocField where fieldname in ('dt', 'doctype', 'doc_type', 'dt_type') and ifnull(options, '') = ''")
print dt_list
dt_list = webnotes.conn.sql("select t1.parent, t1.fieldname from tabDocField t1, tabDocType t2 where t1.parent = t2.name and t1.fieldname in ('dt', 'doctype', 'doc_type', 'dt_type') and ifnull(t1.options, '') = '' and ifnull(t2.issingle, 0) = 0")
for dt in dt_list:
webnotes.conn.sql("update `tab%s` set %s = replace(%s, '%s', '%s') where %s = '%s'" % (dt[0], dt[1], dt[1], d, rendt[d], dt[1], d), debug=1)
webnotes.conn.sql("update `tab%s` set %s = replace(%s, '%s', '%s') where %s = '%s'" % (dt[0], dt[1], dt[1], d, rendt[d], dt[1], d))
# gl mapper, gl entry
webnotes.conn.sql("update `tabGL Mapper Detail` set against_voucher_type = replace(against_voucher_type, %s, %s) where against_voucher_type like '%%%s%%'" % (d, rendt[d], d))
webnotes.conn.sql("update `tabGL Entry` set against_voucher_type = replace(against_voucher_type, %s, %s) where against_voucher_type = '%s'" % (d, rendt[d], d))
webnotes.conn.sql("update `tabGL Entry` set voucher_type = replace(voucher_type, %s, %s) where voucher_type = '%s'" % (d, rendt[d], d))
webnotes.conn.sql("update `tabGL Mapper Detail` set against_voucher_type = replace(against_voucher_type, '%s', '%s') where against_voucher_type like '%%%s%%'" % (d, rendt[d], d))
webnotes.conn.sql("update `tabGL Entry` set against_voucher_type = replace(against_voucher_type, '%s', '%s') where against_voucher_type = '%s'" % (d, rendt[d], d))
webnotes.conn.sql("update `tabGL Entry` set voucher_type = replace(voucher_type, '%s', '%s') where voucher_type = '%s'" % (d, rendt[d], d))
# Stock ledger entry
webnotes.conn.sql("update `tabStock ledger Entry` set voucher_type = replace(voucher_type, %s, %s) where voucher_type = '%s'" % (d, rendt[d], d))
webnotes.conn.sql("update `tabStock ledger Entry` set voucher_type = replace(voucher_type, '%s', '%s') where voucher_type = '%s'" % (d, rendt[d], d))
# Custom fld: options
webnotes.conn.sql("update `tabCustom Field` set options = replace(options, %s, %s) where fieldtype in ('Link', 'Select')", (d, rendt[d]))
@ -143,13 +142,6 @@ def update_dt_in_records(rendt):
def get_dt_to_be_renamed():
"""rendt = {
'Receivable Voucher' : 'Sales Invoice',
'RV Detail' : 'Sales Invoice Item',
'RV Tax Detail' : 'Sales Taxes and Charges',
'Advance Adjustment Detail' : 'Sales Invoice Advance',
}"""
rendt = {
'Receivable Voucher' : 'Sales Invoice',
'RV Detail' : 'Sales Invoice Item',
@ -230,12 +222,6 @@ def get_dt_to_be_renamed():
def get_mapper_to_be_renamed():
"""ren_mapper = {
'Sales Order-Receivable Voucher' : 'Sales Order-Sales Invoice',
'Receivable Voucher-Delivery Note' : 'Sales Invoice-Delivery Note',
'Delivery Note-Receivable Voucher' : 'Delivery Note-Sales Invoice'
}"""
ren_map = {
'Sales Order-Receivable Voucher' : 'Sales Order-Sales Invoice',
'Sales Order-Indent' : 'Sales Order-Purchase Request',