fix: disable list view updates during bulk approval
Also defer document refreshes by up to 5 seconds. Rarely anyone needs truly realtime list view updates. It's better batch them over at least 5 or so seconds if there's a high volume of changes.
This commit is contained in:
parent
892c5e30a2
commit
06a905f600
1 changed files with 13 additions and 6 deletions
|
|
@ -136,7 +136,7 @@ frappe.views.ListView = class ListView extends frappe.views.BaseList {
|
|||
this.workflow_action_items = {};
|
||||
|
||||
const actions = this.actions_menu_items.concat(this.workflow_action_menu_items);
|
||||
actions.map((item) => {
|
||||
actions.forEach((item) => {
|
||||
const $item = this.page.add_actions_menu_item(item.label, item.action, item.standard);
|
||||
if (item.class) {
|
||||
$item.addClass(item.class);
|
||||
|
|
@ -1669,6 +1669,8 @@ frappe.views.ListView = class ListView extends frappe.views.BaseList {
|
|||
|
||||
get_workflow_action_menu_items() {
|
||||
const workflow_actions = [];
|
||||
const me = this;
|
||||
|
||||
if (frappe.model.has_workflow(this.doctype)) {
|
||||
const actions = frappe.workflow.get_all_transition_actions(this.doctype);
|
||||
actions.forEach((action) => {
|
||||
|
|
@ -1676,11 +1678,16 @@ frappe.views.ListView = class ListView extends frappe.views.BaseList {
|
|||
label: __(action),
|
||||
name: action,
|
||||
action: () => {
|
||||
frappe.xcall("frappe.model.workflow.bulk_workflow_approval", {
|
||||
docnames: this.get_checked_items(true),
|
||||
doctype: this.doctype,
|
||||
action: action,
|
||||
});
|
||||
me.disable_list_update = true;
|
||||
frappe
|
||||
.xcall("frappe.model.workflow.bulk_workflow_approval", {
|
||||
docnames: this.get_checked_items(true),
|
||||
doctype: this.doctype,
|
||||
action: action,
|
||||
})
|
||||
.finally(() => {
|
||||
me.disable_list_update = false;
|
||||
});
|
||||
},
|
||||
is_workflow_action: true,
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue