From 79bc01e33d257f65f134ac6230e6c3384bc0c425 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 28 Mar 2012 16:19:01 +0530 Subject: [PATCH] updated rename_dt --- erpnext/patches/jan_mar_2012/rename_dt.py | 26 ++++++----------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/erpnext/patches/jan_mar_2012/rename_dt.py b/erpnext/patches/jan_mar_2012/rename_dt.py index 559e8a5632..2492720ca7 100644 --- a/erpnext/patches/jan_mar_2012/rename_dt.py +++ b/erpnext/patches/jan_mar_2012/rename_dt.py @@ -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',