diff --git a/erpnext/patches/v10_0/workflow_leave_application.py b/erpnext/patches/v10_0/workflow_leave_application.py index 4e0d7e427db..5db5dd93094 100644 --- a/erpnext/patches/v10_0/workflow_leave_application.py +++ b/erpnext/patches/v10_0/workflow_leave_application.py @@ -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',