I’m developing a new app in Frappe, but during the installation on an existing site, I encounter the following issue: if the DocType already exists on the site (because it was created manually or through another app), the app installation fails when trying to create the DocType again. The error looks like: DocType already exists.
I understand that Frappe doesn’t allow the creation of duplicate DocTypes, but I’d like to know if there’s a way to prevent such conflicts or handle this situation more gracefully. Is it possible to check for the existence of a DocType before proceeding with the installation? What’s the best practice to avoid these problems during app installation?
Steps Taken:
- I developed a new DocType in my app.
- While attempting to install the app on a site where a DocType with the same name already exists, the installation fails.
Questions:
- What’s the best way to handle app installation when certain DocTypes already exist on the site?
- Is it possible to skip creating a DocType if it already exists in the database?
- How can I prevent these errors without manually modifying the target site?
Additional Context:
- Frappe version: 12.6.1
- Bench version: 5.0.0
- ERPNext version: 12.9.2
I’d appreciate any guidance or recommendations on how to efficiently address this issue.