Merge pull request #24877 from Anurag810/settings_for_eanbling_leave_notificstion
feat: Add checkbox for disabling leave notification in HR Settings
This commit is contained in:
commit
5cc322e01d
@ -13,6 +13,7 @@
|
|||||||
"stop_birthday_reminders",
|
"stop_birthday_reminders",
|
||||||
"expense_approver_mandatory_in_expense_claim",
|
"expense_approver_mandatory_in_expense_claim",
|
||||||
"leave_settings",
|
"leave_settings",
|
||||||
|
"send_leave_notification",
|
||||||
"leave_approval_notification_template",
|
"leave_approval_notification_template",
|
||||||
"leave_status_notification_template",
|
"leave_status_notification_template",
|
||||||
"role_allowed_to_create_backdated_leave_application",
|
"role_allowed_to_create_backdated_leave_application",
|
||||||
@ -69,15 +70,19 @@
|
|||||||
"label": "Leave Settings"
|
"label": "Leave Settings"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"depends_on": "eval: doc.send_leave_notification == 1",
|
||||||
"fieldname": "leave_approval_notification_template",
|
"fieldname": "leave_approval_notification_template",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"label": "Leave Approval Notification Template",
|
"label": "Leave Approval Notification Template",
|
||||||
|
"mandatory_depends_on": "eval: doc.send_leave_notification == 1",
|
||||||
"options": "Email Template"
|
"options": "Email Template"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"depends_on": "eval: doc.send_leave_notification == 1",
|
||||||
"fieldname": "leave_status_notification_template",
|
"fieldname": "leave_status_notification_template",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"label": "Leave Status Notification Template",
|
"label": "Leave Status Notification Template",
|
||||||
|
"mandatory_depends_on": "eval: doc.send_leave_notification == 1",
|
||||||
"options": "Email Template"
|
"options": "Email Template"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -132,13 +137,19 @@
|
|||||||
"fieldname": "automatically_allocate_leaves_based_on_leave_policy",
|
"fieldname": "automatically_allocate_leaves_based_on_leave_policy",
|
||||||
"fieldtype": "Check",
|
"fieldtype": "Check",
|
||||||
"label": "Automatically Allocate Leaves Based On Leave Policy"
|
"label": "Automatically Allocate Leaves Based On Leave Policy"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"default": "1",
|
||||||
|
"fieldname": "send_leave_notification",
|
||||||
|
"fieldtype": "Check",
|
||||||
|
"label": "Send Leave Notification"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"icon": "fa fa-cog",
|
"icon": "fa fa-cog",
|
||||||
"idx": 1,
|
"idx": 1,
|
||||||
"issingle": 1,
|
"issingle": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2021-02-25 12:31:14.947865",
|
"modified": "2021-03-14 02:04:22.907159",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "HR",
|
"module": "HR",
|
||||||
"name": "HR Settings",
|
"name": "HR Settings",
|
||||||
|
|||||||
@ -40,7 +40,8 @@ class LeaveApplication(Document):
|
|||||||
def on_update(self):
|
def on_update(self):
|
||||||
if self.status == "Open" and self.docstatus < 1:
|
if self.status == "Open" and self.docstatus < 1:
|
||||||
# notify leave approver about creation
|
# notify leave approver about creation
|
||||||
self.notify_leave_approver()
|
if frappe.db.get_single_value("HR Settings", "send_leave_notification"):
|
||||||
|
self.notify_leave_approver()
|
||||||
|
|
||||||
def on_submit(self):
|
def on_submit(self):
|
||||||
if self.status == "Open":
|
if self.status == "Open":
|
||||||
@ -50,7 +51,8 @@ class LeaveApplication(Document):
|
|||||||
self.update_attendance()
|
self.update_attendance()
|
||||||
|
|
||||||
# notify leave applier about approval
|
# notify leave applier about approval
|
||||||
self.notify_employee()
|
if frappe.db.get_single_value("HR Settings", "send_leave_notification"):
|
||||||
|
self.notify_employee()
|
||||||
self.create_leave_ledger_entry()
|
self.create_leave_ledger_entry()
|
||||||
self.reload()
|
self.reload()
|
||||||
|
|
||||||
@ -60,7 +62,8 @@ class LeaveApplication(Document):
|
|||||||
def on_cancel(self):
|
def on_cancel(self):
|
||||||
self.create_leave_ledger_entry(submit=False)
|
self.create_leave_ledger_entry(submit=False)
|
||||||
# notify leave applier about cancellation
|
# notify leave applier about cancellation
|
||||||
self.notify_employee()
|
if frappe.db.get_single_value("HR Settings", "send_leave_notification"):
|
||||||
|
self.notify_employee()
|
||||||
self.cancel_attendance()
|
self.cancel_attendance()
|
||||||
|
|
||||||
def validate_applicable_after(self):
|
def validate_applicable_after(self):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user