Skip to content

Commit

Permalink
fix: type error in workflow (#25847) (#25848)
Browse files Browse the repository at this point in the history
if state is null, we can't get roles for it.

(cherry picked from commit da682ae)

Co-authored-by: Ankush Menat <ankush@frappe.io>
  • Loading branch information
mergify[bot] and ankush committed Apr 8, 2024
1 parent 2b76ee4 commit 835e43f
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions frappe/public/js/frappe/model/workflow.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,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)
);
Expand Down

0 comments on commit 835e43f

Please sign in to comment.