I created a workflow on Work Order doctype. It is working fine. But when I checked the JS triggers I found that on performing workflow action nothing gets triggered in a custom script.
Trigger validate working normally while saving the document.
But when changing workflow state this is not working. Similar things observed on the on_submit trigger.
If I disabled the workflow then everything is work properly.
def update_issue_on_go_back_action(self,method):
workflow_action=frappe.db.get_list('Workflow Action',
filters={
'reference_name': self.name,
'reference_doctype':'Issue'
},
fields=['status', 'user','workflow_state'],
as_list=True
)
if (len(workflow_action)==1):
workflow_action_status=workflow_action[0][0]
workflow_action_workflow_state=workflow_action[0][2]
# you have now all the required field value..based on that take your action
if (self.workflow_state=='Open' and self.status=='Closed' and self.docstatus==0 and self.issue_type==None and workflow_action_status=='Open' and workflow_action_workflow_state=='Open' ):
self.db_set('status', workflow_action_status, update_modified = True)