fix: remove user_doctypes limit from user type as there is no per employee user limit on desk (#38975)

This commit is contained in:
Raheel Khan 2026-04-29 14:33:09 +05:30 committed by GitHub
parent 961183f5a6
commit 9d5783e519
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 0 additions and 35 deletions

View file

@ -51,9 +51,6 @@ def create_user_type(user_type):
if frappe.db.exists("User Type", user_type):
frappe.delete_doc("User Type", user_type)
user_type_limit = {frappe.scrub(user_type): 1}
update_site_config("user_type_doctype_limit", user_type_limit)
doc = frappe.get_doc(
{
"doctype": "User Type",

View file

@ -48,7 +48,6 @@ class UserType(Document):
if self.is_standard:
return
self.validate_document_type_limit()
self.validate_role()
self.add_role_permissions_for_user_doctypes()
self.add_role_permissions_for_select_doctypes()
@ -75,37 +74,6 @@ class UserType(Document):
for module in modules:
self.append("user_type_modules", {"module": module})
def validate_document_type_limit(self):
limit = frappe.conf.get("user_type_doctype_limit", {}).get(frappe.scrub(self.name))
if not limit and frappe.session.user != "Administrator":
frappe.throw(
_("User does not have permission to create the new {0}").format(frappe.bold(_("User Type"))),
title=_("Permission Error"),
)
if limit is None:
frappe.msgprint(
_("The limit has not set for the user type {0} in the site config file.").format(
frappe.bold(self.name)
),
title=_("Set Limit"),
)
return
if self.user_doctypes and len(self.user_doctypes) > limit:
frappe.throw(
_("The total number of user document types limit has been crossed."),
title=_("User Document Types Limit Exceeded"),
)
custom_doctypes = [row.document_type for row in self.user_doctypes if row.is_custom]
if custom_doctypes and len(custom_doctypes) > 3:
frappe.throw(
_("You can only set the 3 custom doctypes in the Document Types table."),
title=_("Custom Document Types Limit Exceeded"),
)
def validate_role(self):
if not self.role:
frappe.throw(_("The field {0} is mandatory").format(frappe.bold(_("Role"))))