fix: addtional salary date validation (#21952) (#21955)

(cherry picked from commit ef0026c06f224a486978164325461abb81e32aac)

Co-authored-by: Anurag Mishra <32095923+Anurag810@users.noreply.github.com>
diff --git a/erpnext/hr/doctype/additional_salary/additional_salary.py b/erpnext/hr/doctype/additional_salary/additional_salary.py
index bab6fb5..e369ba7 100644
--- a/erpnext/hr/doctype/additional_salary/additional_salary.py
+++ b/erpnext/hr/doctype/additional_salary/additional_salary.py
@@ -37,7 +37,7 @@
 				frappe.throw(_("Payroll date can not be less than employee's joining date."))
 			elif getdate(self.from_date) < getdate(date_of_joining):
 				frappe.throw(_("From date can not be less than employee's joining date."))
-			elif getdate(self.to_date) > getdate(relieving_date):
+			elif relieving_date and getdate(self.to_date) > getdate(relieving_date):
 				frappe.throw(_("To date can not be greater than employee's relieving date."))
 
 	def get_amount(self, sal_start_date, sal_end_date):