Skip to content

Commit

Permalink
fix(LANDA Member): delete single record without password (LAN-848)
Browse files Browse the repository at this point in the history
  • Loading branch information
barredterra committed Nov 13, 2024
1 parent 33d108d commit a216755
Showing 1 changed file with 15 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ frappe.listview_settings["LANDA Member"] = {
__("Delete", null, "Button in list view actions menu"),
() => {
const docnames = list_view.get_checked_items(true).map((docname) => docname.toString());
if (docnames.length === 1) {
run_bulk_delete(list_view, docnames);
return;
}

frappe.prompt(
[
Expand All @@ -32,12 +36,7 @@ frappe.listview_settings["LANDA Member"] = {
return;
}

list_view.disable_list_update = true;
bulk_delete(list_view.doctype, docnames, () => {
list_view.disable_list_update = false;
list_view.clear_checked_items();
list_view.refresh();
});
run_bulk_delete(list_view, docnames);
});
},
__("Delete {0} items permanently?", [docnames.length]),
Expand All @@ -51,6 +50,16 @@ frappe.listview_settings["LANDA Member"] = {
},
};


function run_bulk_delete(list_view, docnames) {
list_view.disable_list_update = true;
bulk_delete(list_view.doctype, docnames, () => {
list_view.disable_list_update = false;
list_view.clear_checked_items();
list_view.refresh();
});
}

// copied from frappe/public/js/frappe/list/bulk_operations.js
function bulk_delete(doctype, docnames, done) {
frappe
Expand Down

0 comments on commit a216755

Please sign in to comment.