check if workflow_state_name already exists

This commit is contained in:
Shreya 2018-01-24 14:53:06 +05:30
parent a309a871b5
commit a8a952deff

View File

@ -8,11 +8,12 @@ def execute():
frappe.reload_doc("hr", "doctype", "leave_application")
frappe.reload_doc("workflow", "doctype", "workflow")
frappe.get_doc({
'doctype': 'Workflow State',
'workflow_state_name': 'Open',
'style': 'Warning'
}).insert(ignore_permissions=True)
if not frappe.db.exists("Workflow State", "Open"):
frappe.get_doc({
'doctype': 'Workflow State',
'workflow_state_name': 'Open',
'style': 'Warning'
}).insert(ignore_permissions=True)
frappe.get_doc({
'doctype': 'Workflow',