frappe / frappe

Low code web framework for real world applications, in Python and Javascript
https://frappeframework.com
MIT License
6.99k stars 3.33k forks source link

Option to allow bulk editing doctypes that have a workflow #26002

Open akhilnarang opened 5 months ago

akhilnarang commented 5 months ago

After #25802, this was disabled, to prevent users from being able to possibly circumvent the workflow.

However some users do prefer this, so we could let this be configurable in system settings.

image

KO-IT commented 4 months ago

25802 this has badly backfired to our business. we used to process daily 1000s of workflow documents using bulk edit.

Request you to make it possible the bulk edit again.

wojosc commented 3 months ago

Maybe something that can be added as an option in each individual workflow? "Allow Edit" (Boolean)

Sajith-K-Sasi commented 1 month ago

I also had the same issue, so i made some modification on list_view.js file to check for enable_edit status from the doctype listview settings.

Existing Code

// bulk edit
if (has_editable_fields(doctype) && !frappe.model.has_workflow(doctype)) {
    actions_menu_items.push(bulk_edit());
}

Modification

I have written a function is_bulk_editable to check whether the user hase set enable_edit in listview settings of the doctype. If so it will return the value of enable_edit else it will check whether the doctype has workflow and return true if workflow is not present for the doctype else will return false.

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)
};

// bulk edit
if (has_editable_fields(doctype) && is_bulk_editable(doctype)) {
    actions_menu_items.push(bulk_edit());
}

Example

To enable bulk edit for a doctype set enable_edit to true in listview settings of the doctype. (when doctype has workflow)

frappe.listview_settings["Doctype Name"] = {
    enable_edit: true,
};

To disable bulk edit for a doctype set enable_edit to false in listview settings of the doctype

frappe.listview_settings["Doctype Name"] = {
    enable_edit: false,
};

I have send a PR #27398 for the same in develop branch