mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-15 11:09:17 +00:00
fix: Procurement tracker report (#21422)
* fix: procurement report data was not coming * fix: leave allocation minor issue
This commit is contained in:
@@ -30,16 +30,16 @@ class LeaveAllocation(Document):
|
||||
def validate_leave_allocation_days(self):
|
||||
company = frappe.db.get_value("Employee", self.employee, "company")
|
||||
leave_period = get_leave_period(self.from_date, self.to_date, company)
|
||||
max_leaves_allowed = frappe.db.get_value("Leave Type", self.leave_type, "max_leaves_allowed")
|
||||
max_leaves_allowed = flt(frappe.db.get_value("Leave Type", self.leave_type, "max_leaves_allowed"))
|
||||
if max_leaves_allowed > 0:
|
||||
leave_allocated = 0
|
||||
if leave_period:
|
||||
leave_allocated = get_leave_allocation_for_period(self.employee, self.leave_type,
|
||||
leave_period[0].from_date, leave_period[0].to_date)
|
||||
leave_allocated += self.new_leaves_allocated
|
||||
leave_allocated += flt(self.new_leaves_allocated)
|
||||
if leave_allocated > max_leaves_allowed:
|
||||
frappe.throw(_("Total allocated leaves are more days than maximum allocation of {0} leave type for employee {1} in the period")
|
||||
.format(self.leave_type, self.employee))
|
||||
.format(self.leave_type, self.employee))
|
||||
|
||||
def on_submit(self):
|
||||
self.create_leave_ledger_entry()
|
||||
|
||||
Reference in New Issue
Block a user