Merge pull request #12639 from shreyashah115/workflow-patch-fix
Leave Workflow patch fixes
This commit is contained in:
commit
8d4e63c1fd
@ -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.fichier_des_ecritures_comptables_for_france
|
||||||
erpnext.patches.v10_0.update_assessment_plan
|
erpnext.patches.v10_0.update_assessment_plan
|
||||||
erpnext.patches.v10_0.update_assessment_result
|
erpnext.patches.v10_0.update_assessment_result
|
||||||
erpnext.patches.v10_0.workflow_leave_application
|
erpnext.patches.v10_0.workflow_leave_application #2018-01-24
|
||||||
@ -3,49 +3,10 @@
|
|||||||
|
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import frappe
|
import frappe
|
||||||
|
from erpnext.setup.install import leave_application_workflow
|
||||||
|
|
||||||
def execute():
|
def execute():
|
||||||
frappe.reload_doc("hr", "doctype", "leave_application")
|
frappe.reload_doc("hr", "doctype", "leave_application")
|
||||||
frappe.reload_doc("workflow", "doctype", "workflow")
|
frappe.reload_doc("workflow", "doctype", "workflow")
|
||||||
|
leave_application_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)
|
|
||||||
|
|
||||||
frappe.db.sql("""update `tabLeave Application` set workflow_state = status""")
|
frappe.db.sql("""update `tabLeave Application` set workflow_state = status""")
|
||||||
|
|||||||
@ -12,6 +12,7 @@ default_mail_footer = """<div style="padding: 7px; text-align: right; color: #88
|
|||||||
<a style="color: #888" href="http://erpnext.org">ERPNext</a></div>"""
|
<a style="color: #888" href="http://erpnext.org">ERPNext</a></div>"""
|
||||||
|
|
||||||
def after_install():
|
def after_install():
|
||||||
|
leave_application_workflow()
|
||||||
frappe.get_doc({'doctype': "Role", "role_name": "Analytics"}).insert()
|
frappe.get_doc({'doctype': "Role", "role_name": "Analytics"}).insert()
|
||||||
set_single_defaults()
|
set_single_defaults()
|
||||||
create_compact_item_print_custom_field()
|
create_compact_item_print_custom_field()
|
||||||
@ -19,6 +20,58 @@ def after_install():
|
|||||||
add_all_roles_to("Administrator")
|
add_all_roles_to("Administrator")
|
||||||
frappe.db.commit()
|
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():
|
def check_setup_wizard_not_completed():
|
||||||
if frappe.db.get_default('desktop:home_page') == 'desktop':
|
if frappe.db.get_default('desktop:home_page') == 'desktop':
|
||||||
print()
|
print()
|
||||||
|
|||||||
@ -30,7 +30,7 @@ def get_notification_config():
|
|||||||
"docstatus": ("<", 2)
|
"docstatus": ("<", 2)
|
||||||
},
|
},
|
||||||
"Payment Entry": {"docstatus": 0},
|
"Payment Entry": {"docstatus": 0},
|
||||||
"Leave Application": {"status": "Open"},
|
"Leave Application": {"docstatus": 0},
|
||||||
"Expense Claim": {"approval_status": "Draft"},
|
"Expense Claim": {"approval_status": "Draft"},
|
||||||
"Job Applicant": {"status": "Open"},
|
"Job Applicant": {"status": "Open"},
|
||||||
"Delivery Note": {
|
"Delivery Note": {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user