fix(workflow): enable_action confirmation permission error
* fix: workflow enable_action confirmation * style: apply formatting * fix: function name and handle response * Update frappe/public/js/frappe/form/workflow.js Co-authored-by: Suraj Shetty <13928957+surajshetty3416@users.noreply.github.com> * fix: remove unnecessary backend call * style(workflow): fix lint --------- Co-authored-by: Suraj Shetty <13928957+surajshetty3416@users.noreply.github.com>
This commit is contained in:
parent
3e4f139ff3
commit
b04899f4ae
1 changed files with 10 additions and 16 deletions
|
|
@ -102,22 +102,16 @@ frappe.ui.form.States = class FormStates {
|
|||
if (frappe.user_roles.includes(d.allowed) && has_approval_access(d)) {
|
||||
added = true;
|
||||
me.frm.page.add_action_item(__(d.action), function () {
|
||||
frappe.db
|
||||
.get_value(
|
||||
"Workflow",
|
||||
{ document_type: me.frm.doctype },
|
||||
"enable_action_confirmation"
|
||||
)
|
||||
.then((r) => {
|
||||
if (r.message.enable_action_confirmation) {
|
||||
frappe.confirm(
|
||||
__("Are you sure you want to {0}?", [d.action]),
|
||||
() => me.handle_workflow_action(d)
|
||||
);
|
||||
} else {
|
||||
me.handle_workflow_action(d);
|
||||
}
|
||||
});
|
||||
if (
|
||||
frappe.workflow?.workflows?.[me.frm.doctype]
|
||||
?.enable_action_confirmation
|
||||
) {
|
||||
frappe.confirm(__("Are you sure you want to {0}?", [d.action]), () =>
|
||||
me.handle_workflow_action(d)
|
||||
);
|
||||
} else {
|
||||
me.handle_workflow_action(d);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue