fix: simplify insufficient leave balance message
This commit is contained in:
parent
b2c549a464
commit
8173e6a8ea
@ -295,12 +295,7 @@ class LeaveApplication(Document):
|
|||||||
if leave_balance_for_consumption != self.leave_balance:
|
if leave_balance_for_consumption != self.leave_balance:
|
||||||
msg = _("Warning: Insufficient leave balance for Leave Type {0} in this allocation.").format(frappe.bold(self.leave_type))
|
msg = _("Warning: Insufficient leave balance for Leave Type {0} in this allocation.").format(frappe.bold(self.leave_type))
|
||||||
msg += "<br><br>"
|
msg += "<br><br>"
|
||||||
msg += _("Actual leave balance is {0} but only {1} leave(s) can be consumed between {2} (Application Date) and {3} (Allocation Expiry).").format(
|
msg += _("Actual balances aren't available because the leave application spans over different leave allocations. You can still apply for leaves which would be compensated during the next allocation.")
|
||||||
frappe.bold(self.leave_balance), frappe.bold(leave_balance_for_consumption),
|
|
||||||
frappe.bold(formatdate(self.from_date)),
|
|
||||||
frappe.bold(formatdate(alloc_on_from_date.to_date)))
|
|
||||||
msg += "<br>"
|
|
||||||
msg += _("Remaining leaves would be compensated in the next allocation.")
|
|
||||||
else:
|
else:
|
||||||
msg = _("Warning: Insufficient leave balance for Leave Type {0}.").format(frappe.bold(self.leave_type))
|
msg = _("Warning: Insufficient leave balance for Leave Type {0}.").format(frappe.bold(self.leave_type))
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
|
|
||||||
from itertools import groupby
|
from itertools import groupby
|
||||||
from typing import Dict, List, Tuple
|
from typing import Dict, List, Optional, Tuple
|
||||||
|
|
||||||
import frappe
|
import frappe
|
||||||
from frappe import _
|
from frappe import _
|
||||||
@ -17,7 +17,7 @@ from erpnext.hr.doctype.leave_application.leave_application import (
|
|||||||
|
|
||||||
Filters = frappe._dict
|
Filters = frappe._dict
|
||||||
|
|
||||||
def execute(filters: Filters = None) -> Tuple:
|
def execute(filters: Optional[Filters] = None) -> Tuple:
|
||||||
if filters.to_date <= filters.from_date:
|
if filters.to_date <= filters.from_date:
|
||||||
frappe.throw(_('"From Date" can not be greater than or equal to "To Date"'))
|
frappe.throw(_('"From Date" can not be greater than or equal to "To Date"'))
|
||||||
|
|
||||||
@ -162,7 +162,7 @@ def get_conditions(filters: Filters) -> Dict:
|
|||||||
return conditions
|
return conditions
|
||||||
|
|
||||||
|
|
||||||
def get_department_leave_approver_map(department: str = None):
|
def get_department_leave_approver_map(department: Optional[str] = None):
|
||||||
# get current department and all its child
|
# get current department and all its child
|
||||||
department_list = frappe.get_list('Department',
|
department_list = frappe.get_list('Department',
|
||||||
filters={'disabled': 0},
|
filters={'disabled': 0},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user