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:
pipech 2026-03-06 14:39:10 +07:00 committed by GitHub
parent 3e4f139ff3
commit b04899f4ae
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

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