diff --git a/frappe/desk/doctype/list_view_settings/list_view_settings.json b/frappe/desk/doctype/list_view_settings/list_view_settings.json index aa5a48a2d0..55665be4b6 100644 --- a/frappe/desk/doctype/list_view_settings/list_view_settings.json +++ b/frappe/desk/doctype/list_view_settings/list_view_settings.json @@ -10,6 +10,7 @@ "disable_comment_count", "disable_sidebar_stats", "disable_auto_refresh", + "allow_edit", "total_fields", "fields_html", "fields" @@ -56,10 +57,17 @@ "fieldname": "disable_comment_count", "fieldtype": "Check", "label": "Disable Comment Count" + }, + { + "default": "0", + "description": "Allow editing even if the doctype has a workflow set up.\n\nDoes nothing if a workflow isn't set up.", + "fieldname": "allow_edit", + "fieldtype": "Check", + "label": "Allow Bulk Editing" } ], "links": [], - "modified": "2024-03-23 16:03:29.188038", + "modified": "2024-08-21 18:17:24.889783", "modified_by": "Administrator", "module": "Desk", "name": "List View Settings", diff --git a/frappe/desk/doctype/list_view_settings/list_view_settings.py b/frappe/desk/doctype/list_view_settings/list_view_settings.py index 29a12707bc..3350dcb69e 100644 --- a/frappe/desk/doctype/list_view_settings/list_view_settings.py +++ b/frappe/desk/doctype/list_view_settings/list_view_settings.py @@ -14,6 +14,7 @@ class ListViewSettings(Document): if TYPE_CHECKING: from frappe.types import DF + allow_edit: DF.Check disable_auto_refresh: DF.Check disable_comment_count: DF.Check disable_count: DF.Check diff --git a/frappe/public/js/frappe/list/list_view.js b/frappe/public/js/frappe/list/list_view.js index b11c339162..3f7745b435 100644 --- a/frappe/public/js/frappe/list/list_view.js +++ b/frappe/public/js/frappe/list/list_view.js @@ -1895,6 +1895,14 @@ frappe.views.ListView = class ListView extends frappe.views.BaseList { return frappe.perm.has_perm(doctype, 0, "submit"); }; + const is_bulk_edit_allowed = (doctype) => { + // Check settings if there is a workflow defined, otherwise directly allow + if (frappe.model.has_workflow(doctype)) { + return !!this.list_view_settings?.allow_edit; + } + return true; + }; + // utility const bulk_assignment = () => { return { @@ -2094,7 +2102,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_edit_allowed(doctype)) { actions_menu_items.push(bulk_edit()); }