diff --git a/erpnext/patches.txt b/erpnext/patches.txt index ed051b02b0c..846ca269b10 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -489,4 +489,4 @@ erpnext.patches.v10_0.update_reserved_qty_for_purchase_order erpnext.patches.v10_0.fichier_des_ecritures_comptables_for_france erpnext.patches.v10_0.update_assessment_plan erpnext.patches.v10_0.update_assessment_result -erpnext.patches.v10_0.workflow_leave_application \ No newline at end of file +erpnext.patches.v10_0.workflow_leave_application #2018-01-24 \ No newline at end of file diff --git a/erpnext/patches/v10_0/workflow_leave_application.py b/erpnext/patches/v10_0/workflow_leave_application.py index 5db5dd93094..f2b74a35a78 100644 --- a/erpnext/patches/v10_0/workflow_leave_application.py +++ b/erpnext/patches/v10_0/workflow_leave_application.py @@ -3,49 +3,10 @@ from __future__ import unicode_literals import frappe +from erpnext.setup.install import leave_application_workflow def execute(): frappe.reload_doc("hr", "doctype", "leave_application") frappe.reload_doc("workflow", "doctype", "workflow") - - 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', - 'workflow_name': 'Leave Approval', - 'document_type': 'Leave Application', - 'is_active': 1, - 'workflow_state_field': 'workflow_state', - 'states': [{ - "state": 'Open', - "doc_status": 0, - "allow_edit": 'Employee' - }, { - "state": 'Approved', - "doc_status": 1, - "allow_edit": 'Leave Approver' - }, { - "state": 'Rejected', - "doc_status": 1, - "allow_edit": 'Leave Approver' - }], - 'transitions': [{ - "state": 'Open', - "action": 'Approve', - "next_state": 'Approved', - "allowed": 'Leave Approver' - }, - { - "state": 'Open', - "action": 'Reject', - "next_state": 'Rejected', - "allowed": 'Leave Approver' - }] - }).insert(ignore_permissions=True) - + leave_application_workflow() frappe.db.sql("""update `tabLeave Application` set workflow_state = status""") diff --git a/erpnext/setup/install.py b/erpnext/setup/install.py index 81f909aa845..2cc280ff67e 100644 --- a/erpnext/setup/install.py +++ b/erpnext/setup/install.py @@ -12,6 +12,7 @@ default_mail_footer = """