Rename the doctype

I made a custom doc type in my custom app . This doc type hold a lot of data and this particular doc type is connected to many others . I have many script also regarding this .
Now I want to rename the doc type because it get conflicted to one of the erpnext doc type .
How to do this ? Any suggestion .

1 Like

I think you’ll have to do it manually

  1. Create the doctype with the new name
  2. Copy the code of .py and .js from your old_doctype to your new_doctype
  3. Manually do a search and replace of your old_doctype name with new_doctype name in your code
  4. Delete the old_doctype using the UI, also delete the folder with the old_doctype name

I can not delete the old doc type as it is connected to many other doc type .
Before deleting that I have to delete all the link as well .
I want to have the same table with a different name . is it possible to have without deleting the actual one ?

Can anyone give any idea about the above said problem .
Without deleting is it possible to rename it .
Overwriting a doc type by another name . Is it possible ?

import frappe.model.rename_doc as rd
rd.rename_doc("DocType", old, new, force=True)

You can try this. It’ll rename the Doctype and all its occurrences in link fields, select fields, options, etc.

[quote=“Zlash65, post:5, topic:33779”]
rename_doc[/quote]

doesn’t trigger the after_rename method