fix(setup): avoid duplicate entry for Analytics role (#40183)
diff --git a/erpnext/setup/install.py b/erpnext/setup/install.py
index 527f742..474296d 100644
--- a/erpnext/setup/install.py
+++ b/erpnext/setup/install.py
@@ -18,7 +18,9 @@
def after_install():
- frappe.get_doc({"doctype": "Role", "role_name": "Analytics"}).insert()
+ if not frappe.db.exists("Role", "Analytics"):
+ frappe.get_doc({"doctype": "Role", "role_name": "Analytics"}).insert()
+
set_single_defaults()
create_print_setting_custom_fields()
add_all_roles_to("Administrator")