[minor] check if date of joining is available before creating Salary Slip (#8700)
This commit is contained in:
parent
3257aeeb55
commit
486045e1d1
@ -321,9 +321,13 @@ class SalarySlip(TransactionBase):
|
||||
def sum_components(self, component_type, total_field):
|
||||
joining_date, relieving_date = frappe.db.get_value("Employee", self.employee,
|
||||
["date_of_joining", "relieving_date"])
|
||||
|
||||
if not relieving_date:
|
||||
relieving_date = getdate(self.end_date)
|
||||
|
||||
if not joining_date:
|
||||
frappe.throw(_("Please set the Date Of Joining for employee {0}").format(frappe.bold(employee.employee)))
|
||||
|
||||
for d in self.get(component_type):
|
||||
if ((cint(d.depends_on_lwp) == 1 and not self.salary_slip_based_on_timesheet) or\
|
||||
getdate(self.start_date) < joining_date or getdate(self.end_date) > relieving_date):
|
||||
|
@ -33,6 +33,7 @@ class SalaryStructure(Document):
|
||||
for employee in self.get('employees'):
|
||||
joining_date, relieving_date = frappe.db.get_value("Employee", employee.employee,
|
||||
["date_of_joining", "relieving_date"])
|
||||
|
||||
if employee.from_date and joining_date and getdate(employee.from_date) < joining_date:
|
||||
frappe.throw(_("From Date {0} for Employee {1} cannot be before employee's joining Date {2}")
|
||||
.format(employee.from_date, employee.employee, joining_date))
|
||||
|
Loading…
Reference in New Issue
Block a user