Can a DocType be Cloned?


Is it possible to clone an existing DocType?

As opposed to customising and existing DocType, is there an easy way to clone one instead? So you can make the changes you need to it without having to worry about the original DocType being rendered unusable, or loosing any customisations if you needed to reset the original DocType.


Hi there,

With a custom app, you can duplicate a doctype’s schema then create a new controller object that inherits its methods from the original.

Thanks @peterg, so is this only possible with a new custom app, not within ERPNext itself?


Or with the hook in a custom module declare an override by your own python class (that should inherit of the standard class) and re-code only specifics methods you want to change

You could do it in ERPNext itself, but your changes would be erased on next update. Custom apps allow you to maintain code that interacts with but remains separate from the core.

Thanks @FHenry, though this looks a little out of my current skill set.

Ah, good to know that any customisations would be erased on update. Are existing custom DocTypes retained on update or does everything go?

Would a custom app be a better way to go to allow me build the required functionality I need but still be able to update the ERPNext core and retain the custom DocTypes?

Are there any guides on creating a custom app? It sounds a bit intimidating but hopefully isn’t.

When people talk about customizations, they’re typically talking about two different things: customizations stored in the database and customizations stored in the filesystem. Both exist side-by-side, and many different things can be accomplished both ways. Unfortunately, it’s not always clear which is which, especially if you’re new to Frappe.

As a rule of thumb, though, customizations will only be stored in the file system if (a) you’re editing source-files directly on your server, or (b) you’re making changes to “standard” files in a site with developer_mode turned on.

If you’ve customized doctypes using the “Customize Form” tool, those will persist across doctypes. If you’ve edited doctypes directly in developer mode, those may not.

Custom apps aren’t that hard if you’re familiar with common programming workflows like git management. There’s a tutorial in the docs for creating an app with a new doctype:


Thanks for the link, lot to learn.

I might start out with making a few customs DocTypes within ERPNext and see how it goes. A whole custom app…I’ll work up to it :slightly_smiling_face:

1 Like