Skip to content

Commit

Permalink
fix(test): monthly attendance sheet
Browse files Browse the repository at this point in the history
  • Loading branch information
ruchamahabal committed Jan 3, 2023
1 parent 8df1151 commit e5a187e
Showing 1 changed file with 4 additions and 6 deletions.
@@ -1,7 +1,7 @@
import frappe
from dateutil.relativedelta import relativedelta
from frappe.tests.utils import FrappeTestCase
from frappe.utils import now_datetime
from frappe.utils import add_months, getdate

from erpnext.hr.doctype.attendance.attendance import mark_attendance
from erpnext.hr.doctype.employee.test_employee import make_employee
Expand All @@ -14,9 +14,7 @@ def setUp(self):
frappe.db.delete("Attendance", {"employee": self.employee})

def test_monthly_attendance_sheet_report(self):
now = now_datetime()
previous_month = now.month - 1
previous_month_first = now.replace(day=1).replace(month=previous_month).date()
previous_month_first = add_months(getdate(), -1).replace(day=1)

company = frappe.db.get_value("Employee", self.employee, "company")

Expand All @@ -27,8 +25,8 @@ def test_monthly_attendance_sheet_report(self):

filters = frappe._dict(
{
"month": previous_month,
"year": now.year,
"month": previous_month_first.month,
"year": previous_month_first.year,
"company": company,
}
)
Expand Down

0 comments on commit e5a187e

Please sign in to comment.