fix: guard role_profiles_add/remove when roles_editor is missing
This commit is contained in:
parent
20e57c2df5
commit
d7776767a8
1 changed files with 14 additions and 6 deletions
|
|
@ -432,18 +432,26 @@ frappe.ui.form.on("User Email", {
|
|||
frappe.ui.form.on("User Role Profile", {
|
||||
role_profiles_add: function (frm) {
|
||||
if (frm.doc.role_profiles.length > 0) {
|
||||
frm.roles_editor.disable = 1;
|
||||
if (frm.roles_editor) {
|
||||
frm.roles_editor.disable = 1;
|
||||
}
|
||||
frm.call("populate_role_profile_roles").then(() => {
|
||||
frm.roles_editor.show();
|
||||
if (frm.roles_editor) {
|
||||
frm.roles_editor.show();
|
||||
}
|
||||
});
|
||||
$(".deselect-all, .select-all").prop("disabled", true);
|
||||
if (frm.roles_editor) {
|
||||
$(".deselect-all, .select-all").prop("disabled", true);
|
||||
}
|
||||
}
|
||||
},
|
||||
role_profiles_remove: function (frm) {
|
||||
if (frm.doc.role_profiles.length == 0) {
|
||||
frm.roles_editor.disable = 0;
|
||||
frm.roles_editor.show();
|
||||
$(".deselect-all, .select-all").prop("disabled", false);
|
||||
if (frm.roles_editor) {
|
||||
frm.roles_editor.disable = 0;
|
||||
frm.roles_editor.show();
|
||||
$(".deselect-all, .select-all").prop("disabled", false);
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue