feat: make permission type exportable

This commit is contained in:
Saqib Ansari 2025-10-30 14:05:01 +05:30
parent f687f2a457
commit 2f3af6adf1
5 changed files with 21 additions and 9 deletions

View file

@ -19,7 +19,7 @@
"grid_page_length": 50,
"index_web_pages_for_search": 1,
"links": [],
"modified": "2025-07-28 13:13:31.411625",
"modified": "2025-10-30 14:03:44.453713",
"modified_by": "Administrator",
"module": "Core",
"name": "Permission Type",
@ -34,7 +34,7 @@
"print": 1,
"read": 1,
"report": 1,
"role": "System Manager",
"role": "Administrator",
"share": 1,
"write": 1
}

View file

@ -3,6 +3,7 @@
import frappe
from frappe.model.document import Document
from frappe.modules.utils import get_doctype_module
class PermissionType(Document):
@ -18,6 +19,12 @@ class PermissionType(Document):
# end: auto-generated types
def on_update(self):
if frappe.conf.developer_mode:
from frappe.modules.export_file import export_to_files
module = get_doctype_module(self.applicable_for)
export_to_files(record_list=[["Permission Type", self.name]], record_module=module)
doctypes = ["Custom DocPerm", "DocPerm"]
for doctype in doctypes:
self.create_custom_docperm(doctype)

View file

@ -0,0 +1,11 @@
{
"applicable_for": "User",
"creation": "2025-10-30 13:06:43.521313",
"docstatus": 0,
"doctype": "Permission Type",
"idx": 0,
"modified": "2025-10-30 13:59:38.160474",
"modified_by": "Administrator",
"name": "impersonate",
"owner": "Administrator"
}

View file

@ -576,13 +576,6 @@ persistent_cache_keys = [
"rl:*",
]
fixtures = [
{
"dt": "Permission Type",
"filters": {"name": "impersonate", "applicable_for": "User"},
},
]
user_invitation = {
"allowed_roles": {
"System Manager": [],

View file

@ -34,6 +34,7 @@ IMPORTABLE_DOCTYPES = [
("core", "server_script"),
("custom", "custom_field"),
("custom", "property_setter"),
("core", "permission_type"),
]