fix: Do not check for orphaned states in new workflows
This commit is contained in:
parent
cac7cc402f
commit
a5ed59bb4e
2 changed files with 4 additions and 1 deletions
|
|
@ -96,6 +96,7 @@ frappe.ui.form.on("Workflow", {
|
|||
});
|
||||
},
|
||||
get_orphaned_states_and_count: function(frm) {
|
||||
if (frm.is_new()) return;
|
||||
let states_list = [];
|
||||
frm.doc.states.map(state => states_list.push(state.state));
|
||||
return frappe.xcall('frappe.workflow.doctype.workflow.workflow.get_workflow_state_count', {
|
||||
|
|
|
|||
|
|
@ -119,7 +119,9 @@ def get_workflow_state_count(doctype, workflow_state_field, states):
|
|||
result = frappe.get_all(
|
||||
doctype,
|
||||
fields=[workflow_state_field, 'count(*) as count', 'docstatus'],
|
||||
filters = {'workflow_state': ['not in', states]},
|
||||
filters = {
|
||||
workflow_state_field: ['not in', states]
|
||||
},
|
||||
group_by = workflow_state_field
|
||||
)
|
||||
return [r for r in result if r[workflow_state_field]]
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue