Merge pull request #27398 from Sajith-K-Sasi/develop
feat: enable bulk edit for doctype with workflow
This commit is contained in:
commit
cab0b2e484
3 changed files with 19 additions and 2 deletions
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue