From 9c011f405d7154a4c7b571e0804fc5a4d7d0b022 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Tue, 29 May 2012 15:47:27 +0530 Subject: [PATCH] new rename doc function --- erpnext/patches/jan_mar_2012/rename_dt.py | 11 +++++++---- erpnext/patches/patch_list.py | 10 +++++----- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/erpnext/patches/jan_mar_2012/rename_dt.py b/erpnext/patches/jan_mar_2012/rename_dt.py index 9d92fadffb..a507a1c4ab 100644 --- a/erpnext/patches/jan_mar_2012/rename_dt.py +++ b/erpnext/patches/jan_mar_2012/rename_dt.py @@ -1,6 +1,6 @@ import webnotes import conf -from webnotes.model import rename, delete_doc +import webnotes.model from webnotes.model.code import get_obj from wnf import replace_code from termcolor import colored @@ -150,10 +150,13 @@ def rename_in_db(ren_data, data_type, is_doctype): print colored('Renaming... ' + d + ' --> '+ ren_data[d], 'yellow') #rename try: - rename(data_type, d, ren_data[d], is_doctype) + webnotes.model.rename(data_type, d, ren_data[d], is_doctype) except Exception, e: - print e - pass + if e.args[0]!=1050: + raise e + else: + print e + pass def update_dt_in_records(rendt): diff --git a/erpnext/patches/patch_list.py b/erpnext/patches/patch_list.py index f8738e51e4..e781e9d4ce 100644 --- a/erpnext/patches/patch_list.py +++ b/erpnext/patches/patch_list.py @@ -227,16 +227,16 @@ patch_list = [ 'patch_file': 'so_rv_mapper_fix', 'description': 'SO-RV duplicate mapper entry removal' }, - { - 'patch_module': 'patches.jan_mar_2012', - 'patch_file': 'sync_ref_db', - 'description': 'Deletes non required doctypes' - }, { 'patch_module': 'patches.mar_2012', 'patch_file': 'clean_property_setter', 'description': 'Patch related to property setter cleanup' }, + { + 'patch_module': 'patches.jan_mar_2012', + 'patch_file': 'sync_ref_db', + 'description': 'Deletes non required doctypes' + }, { 'patch_module': 'patches.april_2012', 'patch_file': 'naming_series_patch',