Custom doctype in custom app[Solved]

Hi, I’m creating custom app with some custom doctypes. On creation everything works as expected. When I create new docType, folder and files (js, py, json) are created.

However if I run bench uninstall-app, all doctypes inside “doctype” folder is deleted from my custom app folder.

I think that doctypes should only be deleted from database not from the app folder.

What am I missing here?

Maybe try this:

bench --site [sitename] remove-from-installed-apps formis

remove-from-installed-apps Remove app from site’s installed-apps list
uninstall-app Remove app and linked modules from site

Reference VM error on update - #3 by sp9leo

I don’t have issues with removing app, I just wasn’t aware of the fact, that when you uninstall your custom app, all doctypes within that app folder get deleted. All other files stay intact. So basically if you want to reinstall app you can’t. Unless you replace your app folder with fresh one.

Since this is probably by design i will consider topic solved.

From v12, on using ‘uninstall-app’ bench command, it deletes all doctypes files from custom app folder
i.e.
bench --site mysite uninstall-app mycustomapp
All doctypes (including custom), modules related to this app will be deleted. Are you sure you want to continue (y/n) ? y

So you have 2 options,
[1]now use remove-from-installed-apps
i.e.
bench --site mysite remove-from-installed-apps mycustomapp
[2] go to custom app folder and do git stash to undo deleted files
git stash

1 Like

Additional Info, the above command just removes the app from the instance while keeps the Doctypes in the instance (& in database) intact.