Leave workflow patch fixes (#12823)

* modified patch for leave application workflow

* removed leave approval field from leave application doctype

* fetch lwp and attendance only if workflow field exists

* modified test cases

* modified files with leave application

* docstatus draft for rejected applications

* modified leave application calendar

* test fixed

* run patch only if any record exists
This commit is contained in:
Shreya Shah
2018-02-12 16:02:57 +05:30
committed by Nabin Hait
parent c69f4c0c79
commit d9a585bdad
14 changed files with 85 additions and 371 deletions

View File

@@ -12,7 +12,6 @@ default_mail_footer = """<div style="padding: 7px; text-align: right; color: #88
<a style="color: #888" href="http://erpnext.org">ERPNext</a></div>"""
def after_install():
leave_application_workflow()
frappe.get_doc({'doctype': "Role", "role_name": "Analytics"}).insert()
set_single_defaults()
create_compact_item_print_custom_field()
@@ -20,58 +19,6 @@ def after_install():
add_all_roles_to("Administrator")
frappe.db.commit()
def leave_application_workflow():
states = {'Approved': 'Success', 'Rejected': 'Danger', 'Open': 'Warning'}
for state, style in states.items():
if not frappe.db.exists("Workflow State", state):
frappe.get_doc({
'doctype': 'Workflow State',
'workflow_state_name': state,
'style': style
}).insert(ignore_permissions=True)
for action in ['Approve', 'Reject']:
if not frappe.db.exists("Workflow Action", action):
frappe.get_doc({
'doctype': 'Workflow Action',
'workflow_action_name': action
}).insert(ignore_permissions=True)
if not frappe.db.exists("Workflow", "Leave Approval"):
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)
def check_setup_wizard_not_completed():
if frappe.db.get_default('desktop:home_page') == 'desktop':
print()