mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-09 08:11:19 +00:00
Merge pull request #19294 from vijaywm/duplicate-attendance
fix: Typo in attendance date filter
This commit is contained in:
@@ -125,7 +125,7 @@ class LeaveApplication(Document):
|
|||||||
status = "Half Day" if date == self.half_day_date else "On Leave"
|
status = "Half Day" if date == self.half_day_date else "On Leave"
|
||||||
|
|
||||||
attendance_name = frappe.db.exists('Attendance', dict(employee = self.employee,
|
attendance_name = frappe.db.exists('Attendance', dict(employee = self.employee,
|
||||||
attenance_date = date, docstatus = ('!=', 2)))
|
attendance_date = date, docstatus = ('!=', 2)))
|
||||||
|
|
||||||
if attendance_name:
|
if attendance_name:
|
||||||
# update existing attendance, change absent to on leave
|
# update existing attendance, change absent to on leave
|
||||||
|
|||||||
@@ -5,6 +5,12 @@ from frappe import _
|
|||||||
|
|
||||||
def get_data():
|
def get_data():
|
||||||
return {
|
return {
|
||||||
|
'fieldname': 'leave_application',
|
||||||
|
'transactions': [
|
||||||
|
{
|
||||||
|
'items': ['Attendance']
|
||||||
|
}
|
||||||
|
],
|
||||||
'reports': [
|
'reports': [
|
||||||
{
|
{
|
||||||
'label': _('Reports'),
|
'label': _('Reports'),
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ class TestLeaveApplication(unittest.TestCase):
|
|||||||
application.to_date = "2013-01-05"
|
application.to_date = "2013-01-05"
|
||||||
return application
|
return application
|
||||||
|
|
||||||
def test_attendance_creation(self):
|
def test_overwrite_attendance(self):
|
||||||
'''check attendance is automatically created on leave approval'''
|
'''check attendance is automatically created on leave approval'''
|
||||||
make_allocation_record()
|
make_allocation_record()
|
||||||
application = self.get_application(_test_records[0])
|
application = self.get_application(_test_records[0])
|
||||||
@@ -82,7 +82,8 @@ class TestLeaveApplication(unittest.TestCase):
|
|||||||
application.insert()
|
application.insert()
|
||||||
application.submit()
|
application.submit()
|
||||||
|
|
||||||
attendance = frappe.get_all('Attendance', ['name', 'status', 'attendance_date'], dict(leave_application = application.name))
|
attendance = frappe.get_all('Attendance', ['name', 'status', 'attendance_date'],
|
||||||
|
dict(attendance_date=('between', ['2018-01-01', '2018-01-03']), docstatus=("!=", 2)))
|
||||||
|
|
||||||
# attendance created for all 3 days
|
# attendance created for all 3 days
|
||||||
self.assertEqual(len(attendance), 3)
|
self.assertEqual(len(attendance), 3)
|
||||||
@@ -95,20 +96,6 @@ class TestLeaveApplication(unittest.TestCase):
|
|||||||
for d in ('2018-01-01', '2018-01-02', '2018-01-03'):
|
for d in ('2018-01-01', '2018-01-02', '2018-01-03'):
|
||||||
self.assertTrue(getdate(d) in dates)
|
self.assertTrue(getdate(d) in dates)
|
||||||
|
|
||||||
def test_overwrite_attendance(self):
|
|
||||||
# employee marked as absent
|
|
||||||
doc = frappe.new_doc("Attendance")
|
|
||||||
doc.employee = '_T-Employee-00001'
|
|
||||||
doc.attendance_date = '2018-01-01'
|
|
||||||
doc.company = '_Test Company'
|
|
||||||
doc.status = 'Absent'
|
|
||||||
doc.flags.ignore_validate = True
|
|
||||||
doc.insert(ignore_permissions=True)
|
|
||||||
doc.submit()
|
|
||||||
|
|
||||||
# now check if the status has been updated
|
|
||||||
self.test_attendance_creation()
|
|
||||||
|
|
||||||
def test_block_list(self):
|
def test_block_list(self):
|
||||||
self._clear_roles()
|
self._clear_roles()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user