ERPNext.com Frappe Cloud Support Partners Foundation Frappe School

New doctype in existing module or in custom app?

Hi there,

Been reading the forum but I haven’t found what I’ve been looking for, so far.

I’m currently using fixtures for some customization that I made in the Projects module, and export the fixtures to a custom app, but now I need to make new doctypes.

My questions is, which is better, using Projects module and create new doctypes inside the Projects module or copy all Projects module into a custom app module and create new doctypes inside the custom app module?

Or perhaps there is another, better way that I haven’t thought of?

Thanks in advance for your comments/suggestions.

Hi @gueriza,

the correct answer is probably it depends :wink: I would recommend to add your new doctypes in your custom app. This will make it easier to deploy and give you more possibilities (e.g. only like this you can add server side code to your new doctypes). Also, assuming you have a development system along your production system, this will be easier to try out things before they go live.

In case the new doctypes you need are for general use, then it might make sense to consider adding them to the ERPNext app / Projects module. In this case, make a fork of ERPNext, develop the new features and send in a PR. But I guess it is more something specific.

Hope this helps.

1 Like

Hi @lasalesi,

Thanks for your reply. The new Doctype is actually pretty specific to my requirement (a report consists of combined fields and custom fields in Project doctype).

Correct me if I’m wrong, so in my case it’s probably best to move all Project module into my custom app, and add new doctypes in there, making them together in a module?

You don’t need to copy core files, your custom app with custom DocTypes will have full access to any core tables and functions.

Thanks @igrekus for your reply

hi @lasalesi and how do I add a new doctype to my custom app

Hi @Alkautsar,

you can go to “Doctype list” and click new and then select your app in the module dropdown and create your doctype. Does that help?

@lasalesi
When new doctype is added to your custom app it is listed under setup can we rename that setup to another name?

You can actually control where your custom doctypes appear using the (your_app)/(your_app)/config/(your_app).py file.

For reference as an example https://github.com/libracore/erpnextswiss/blob/master/erpnextswiss/config/erpnextswiss.py