feat: enable and disable bulk edit for doctype using listview settings

This commit is contained in:
Sajith K 2024-08-14 14:42:34 +05:30 committed by Akhil Narang
parent b3d9188d08
commit 1387bc5603
No known key found for this signature in database
GPG key ID: 9DCC61E211BF645F

View file

@ -1895,6 +1895,13 @@ frappe.views.ListView = class ListView extends frappe.views.BaseList {
return frappe.perm.has_perm(doctype, 0, "submit");
};
const is_bulk_editable = (doctype) => {
if (frappe.listview_settings[doctype] && frappe.listview_settings[doctype].enable_edit!=undefined){
return frappe.listview_settings[doctype].enable_edit;
}
return !frappe.model.has_workflow(doctype)
};
// utility
const bulk_assignment = () => {
return {
@ -2094,7 +2101,7 @@ frappe.views.ListView = class ListView extends frappe.views.BaseList {
};
// bulk edit
if (has_editable_fields(doctype) && !frappe.model.has_workflow(doctype)) {
if (has_editable_fields(doctype) && is_bulk_editable(doctype)) {
actions_menu_items.push(bulk_edit());
}