fix: remove enable_action_confirmation on workflow transition

This commit is contained in:
theerayut 2025-09-05 07:42:24 +07:00
parent ac3ae547e8
commit 18a83f426b
3 changed files with 23 additions and 27 deletions

View file

@ -102,13 +102,22 @@ 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 () {
if (d.enable_action_confirmation || me.frm.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);
}
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);
}
});
});
}
});

View file

@ -18,14 +18,9 @@ let properties = computed(() => {
if (store.workflow.selected && "action" in store.workflow.selected.data) {
title.value = __("Transition Properties");
return store.transitionfields.filter((df) =>
[
"action",
"allowed",
"allow_self_approval",
"enable_action_confirmation",
"condition",
"transition_tasks",
].includes(df.fieldname)
["action", "allowed", "allow_self_approval", "condition", "transition_tasks"].includes(
df.fieldname
)
);
} else if (store.workflow.selected && "state" in store.workflow.selected.data) {
title.value = __("State Properties");

View file

@ -12,7 +12,6 @@
"allowed",
"allow_self_approval",
"send_email_to_creator",
"enable_action_confirmation",
"transition_tasks",
"conditions",
"condition",
@ -103,17 +102,10 @@
"label": "Send Email To Creator"
},
{
"default": "0",
"description": "If checked, a confirmation will be required before performing workflow actions.",
"fieldname": "enable_action_confirmation",
"fieldtype": "Check",
"label": "Enable Action Confirmation"
},
{
"fieldname": "transition_tasks",
"fieldtype": "Link",
"label": "Transition Tasks",
"options": "Workflow Transition Tasks"
"fieldname": "transition_tasks",
"fieldtype": "Link",
"label": "Transition Tasks",
"options": "Workflow Transition Tasks"
}
],
"idx": 1,