Employee Benefit Application - validate duplicate
This commit is contained in:
parent
9cd292b187
commit
41616de9cc
@ -4,7 +4,21 @@
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe import _
|
||||
from frappe.model.document import Document
|
||||
|
||||
class EmployeeBenefitApplication(Document):
|
||||
pass
|
||||
def before_submit(self):
|
||||
self.validate_duplicate_on_payroll_period()
|
||||
|
||||
def validate_duplicate_on_payroll_period(self):
|
||||
application = frappe.db.exists(
|
||||
"Employee Benefit Application",
|
||||
{
|
||||
'employee': self.employee,
|
||||
'payroll_period': self.payroll_period,
|
||||
'docstatus': 1
|
||||
}
|
||||
)
|
||||
if application:
|
||||
frappe.throw(_("Employee {0} already submited an apllication {1} for the payroll period {2}").format(self.employee, application, self.payroll_period))
|
||||
|
Loading…
x
Reference in New Issue
Block a user