fix: validation for additional salary (#22645)

* fix: validation for additional salary

* fix:changes requested

Co-authored-by: Rucha Mahabal <ruchamahabal2@gmail.com>

Co-authored-by: Rucha Mahabal <ruchamahabal2@gmail.com>
This commit is contained in:
Anurag Mishra 2020-07-16 13:10:43 +05:30 committed by GitHub
parent aab0ada598
commit ac23ac6a02
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 6 deletions

View File

@ -8,8 +8,7 @@ frappe.ui.form.on('Additional Salary', {
frm.set_query("employee", function() { frm.set_query("employee", function() {
return { return {
filters: { filters: {
company: frm.doc.company, company: frm.doc.company
status: "Active"
} }
}; };
}); });

View File

@ -33,12 +33,16 @@ class AdditionalSalary(Document):
frappe.throw(_("From Date can not be greater than To Date.")) frappe.throw(_("From Date can not be greater than To Date."))
if date_of_joining: if date_of_joining:
if getdate(self.payroll_date) < getdate(date_of_joining): if self.payroll_date and getdate(self.payroll_date) < getdate(date_of_joining):
frappe.throw(_("Payroll date can not be less than employee's joining date.")) frappe.throw(_("Payroll date can not be less than employee's joining date."))
elif getdate(self.from_date) < getdate(date_of_joining): elif self.from_date and getdate(self.from_date) < getdate(date_of_joining):
frappe.throw(_("From date can not be less than employee's joining date.")) frappe.throw(_("From date can not be less than employee's joining date."))
elif relieving_date and getdate(self.to_date) > getdate(relieving_date):
if relieving_date:
if self.to_date and getdate(self.to_date) > getdate(relieving_date):
frappe.throw(_("To date can not be greater than employee's relieving date.")) frappe.throw(_("To date can not be greater than employee's relieving date."))
if self.payroll_date and getdate(self.payroll_date) > getdate(relieving_date):
frappe.throw(_("Payroll date can not be greater than employee's relieving date."))
def get_amount(self, sal_start_date, sal_end_date): def get_amount(self, sal_start_date, sal_end_date):
start_date = getdate(sal_start_date) start_date = getdate(sal_start_date)