From 4a1d000c336e640c46512134cd364e733d65e4e6 Mon Sep 17 00:00:00 2001 From: deepeshgarg007 Date: Thu, 31 Oct 2019 15:57:15 +0530 Subject: [PATCH] fix: Test Case --- .../leave_application_dashboard.py | 6 ++++++ .../test_leave_application.py | 19 +++---------------- 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/erpnext/hr/doctype/leave_application/leave_application_dashboard.py b/erpnext/hr/doctype/leave_application/leave_application_dashboard.py index 8075b7b5c5..c1d6a6665b 100644 --- a/erpnext/hr/doctype/leave_application/leave_application_dashboard.py +++ b/erpnext/hr/doctype/leave_application/leave_application_dashboard.py @@ -5,6 +5,12 @@ from frappe import _ def get_data(): return { + 'fieldname': 'leave_application', + 'transactions': [ + { + 'items': ['Attendance'] + } + ], 'reports': [ { 'label': _('Reports'), diff --git a/erpnext/hr/doctype/leave_application/test_leave_application.py b/erpnext/hr/doctype/leave_application/test_leave_application.py index ad141a5748..38ae808f27 100644 --- a/erpnext/hr/doctype/leave_application/test_leave_application.py +++ b/erpnext/hr/doctype/leave_application/test_leave_application.py @@ -72,7 +72,7 @@ class TestLeaveApplication(unittest.TestCase): application.to_date = "2013-01-05" return application - def test_attendance_creation(self): + def test_overwrite_attendance(self): '''check attendance is automatically created on leave approval''' make_allocation_record() application = self.get_application(_test_records[0]) @@ -82,7 +82,8 @@ class TestLeaveApplication(unittest.TestCase): application.insert() 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 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'): 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): self._clear_roles()