From a8a952deff8d5aa90f96eb956bfc5173989c21f0 Mon Sep 17 00:00:00 2001 From: Shreya Date: Wed, 24 Jan 2018 14:53:06 +0530 Subject: [PATCH] check if workflow_state_name already exists --- erpnext/patches/v10_0/workflow_leave_application.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/erpnext/patches/v10_0/workflow_leave_application.py b/erpnext/patches/v10_0/workflow_leave_application.py index 4e0d7e427d..5db5dd9309 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',