validate: if additional salary exists (#17529)
This commit is contained in:
parent
067d3c0c09
commit
0e31089af6
@ -9,6 +9,12 @@ from frappe import _
|
|||||||
from frappe.utils import getdate, date_diff
|
from frappe.utils import getdate, date_diff
|
||||||
|
|
||||||
class AdditionalSalary(Document):
|
class AdditionalSalary(Document):
|
||||||
|
def before_insert(self):
|
||||||
|
if frappe.db.exists("Additional Salary", {"employee": self.employee, "salary_component": self.salary_component,
|
||||||
|
"amount": self.amount, "payroll_date": self.payroll_date, "company": self.company}):
|
||||||
|
|
||||||
|
frappe.throw(_("Additional Salary Component Exists."))
|
||||||
|
|
||||||
def validate(self):
|
def validate(self):
|
||||||
self.validate_dates()
|
self.validate_dates()
|
||||||
if self.amount < 0:
|
if self.amount < 0:
|
||||||
|
Loading…
Reference in New Issue
Block a user