workflow patch fix
This commit is contained in:
parent
8df0556af5
commit
61cf49dd07
@ -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
|
||||
erpnext.patches.v10_0.workflow_leave_application #2018-01-24
|
@ -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""")
|
||||
|
@ -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>"""
|
||||
|
||||
def after_install():
|
||||
leave_application_workflow()
|
||||
frappe.get_doc({'doctype': "Role", "role_name": "Analytics"}).insert()
|
||||
set_single_defaults()
|
||||
create_compact_item_print_custom_field()
|
||||
@ -19,6 +20,51 @@ 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)
|
||||
|
||||
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()
|
||||
|
@ -30,7 +30,7 @@ def get_notification_config():
|
||||
"docstatus": ("<", 2)
|
||||
},
|
||||
"Payment Entry": {"docstatus": 0},
|
||||
"Leave Application": {"status": "Open"},
|
||||
"Leave Application": {"docstatus": 0},
|
||||
"Expense Claim": {"approval_status": "Draft"},
|
||||
"Job Applicant": {"status": "Open"},
|
||||
"Delivery Note": {
|
||||
|
Loading…
Reference in New Issue
Block a user