fix: type error in workflow (#25847)

if state is null, we can't get roles for it.
This commit is contained in:
Ankush Menat 2024-04-08 12:59:23 +05:30 committed by GitHub
parent 551c8d5ef4
commit da682ae44c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -59,10 +59,9 @@ frappe.workflow = {
var state =
doc[state_fieldname] || frappe.workflow.get_default_state(doctype, doc.docstatus);
if (!state) return false;
let allow_edit_roles = state
? frappe.workflow.get_document_state_roles(doctype, state)
: null;
let allow_edit_roles = frappe.workflow.get_document_state_roles(doctype, state);
let has_common_role = frappe.user_roles.some((role) =>
allow_edit_roles.includes(role)
);