fix: add default system manager role when changing from child to non-child table doctype
This commit is contained in:
parent
c200f5b3ae
commit
ddbbc0ef8d
2 changed files with 12 additions and 7 deletions
|
|
@ -46,9 +46,7 @@ frappe.ui.form.on('DocType', {
|
|||
}
|
||||
|
||||
if(frm.is_new()) {
|
||||
if (!(frm.doc.permissions && frm.doc.permissions.length)) {
|
||||
frm.add_child('permissions', {role: 'System Manager'});
|
||||
}
|
||||
frm.events.set_default_permission(frm);
|
||||
} else {
|
||||
frm.toggle_enable("engine", 0);
|
||||
}
|
||||
|
|
@ -65,6 +63,14 @@ frappe.ui.form.on('DocType', {
|
|||
if (frm.doc.istable && frm.is_new()) {
|
||||
frm.set_value('autoname', 'autoincrement');
|
||||
frm.set_value('allow_rename', 0);
|
||||
} else if (!frm.doc.istable && !frm.is_new()) {
|
||||
frm.events.set_default_permission(frm);
|
||||
}
|
||||
},
|
||||
|
||||
set_default_permission: (frm) => {
|
||||
if (!(frm.doc.permissions && frm.doc.permissions.length)) {
|
||||
frm.add_child('permissions', {role: 'System Manager'});
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -181,10 +181,6 @@ class DocType(Document):
|
|||
)
|
||||
)
|
||||
|
||||
def after_insert(self):
|
||||
# clear user cache so that on the next reload this doctype is included in boot
|
||||
clear_user_cache(frappe.session.user)
|
||||
|
||||
def set_defaults_for_single_and_table(self):
|
||||
if self.issingle:
|
||||
self.allow_import = 0
|
||||
|
|
@ -412,6 +408,9 @@ class DocType(Document):
|
|||
delete_notification_count_for(doctype=self.name)
|
||||
frappe.clear_cache(doctype=self.name)
|
||||
|
||||
# clear user cache so that on the next reload this doctype is included in boot
|
||||
clear_user_cache(frappe.session.user)
|
||||
|
||||
if not frappe.flags.in_install and hasattr(self, "before_update"):
|
||||
self.sync_global_search()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue