def validate_duplicate_record(self):
res=frappe.db.sql(
“”"
select name from tabTimesheet
where employee=%s
and date=%s
and name !=%s
and docstatus != 2
“”",
(self.employee,getdate(self.date), self.name),
)
if res:
frappe.throw(_
("Timesheet for employee {0} is already fill for the date{1}").format(frappe.bold(self.employee),
frappe.bold(self.date)
)
)