fix: Handle the "no leave_allocation found" case (#23922)
* fix: Handle the "no leave_allocation found" case * fix: format of error msg
This commit is contained in:
parent
23614b650e
commit
c72b693223
@ -32,7 +32,7 @@ class LeaveEncashment(Document):
|
|||||||
additional_salary.employee = self.employee
|
additional_salary.employee = self.employee
|
||||||
earning_component = frappe.get_value("Leave Type", self.leave_type, "earning_component")
|
earning_component = frappe.get_value("Leave Type", self.leave_type, "earning_component")
|
||||||
if not earning_component:
|
if not earning_component:
|
||||||
frappe.throw(_("Please set Earning Component for Leave type: {0}.".format(self.leave_type)))
|
frappe.throw(_("Please set Earning Component for Leave type: {0}.").format(self.leave_type))
|
||||||
additional_salary.salary_component = earning_component
|
additional_salary.salary_component = earning_component
|
||||||
additional_salary.payroll_date = self.encashment_date
|
additional_salary.payroll_date = self.encashment_date
|
||||||
additional_salary.amount = self.encashment_amount
|
additional_salary.amount = self.encashment_amount
|
||||||
@ -98,7 +98,11 @@ class LeaveEncashment(Document):
|
|||||||
create_leave_ledger_entry(self, args, submit)
|
create_leave_ledger_entry(self, args, submit)
|
||||||
|
|
||||||
# create reverse entry for expired leaves
|
# create reverse entry for expired leaves
|
||||||
to_date = self.get_leave_allocation().get('to_date')
|
leave_allocation = self.get_leave_allocation()
|
||||||
|
if not leave_allocation:
|
||||||
|
return
|
||||||
|
|
||||||
|
to_date = leave_allocation.get('to_date')
|
||||||
if to_date < getdate(nowdate()):
|
if to_date < getdate(nowdate()):
|
||||||
args = frappe._dict(
|
args = frappe._dict(
|
||||||
leaves=self.encashable_days,
|
leaves=self.encashable_days,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user