mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-09 08:02:51 +00:00
fix: tests
This commit is contained in:
@@ -167,15 +167,11 @@ class EmployeeHoursReport:
|
||||
|
||||
def set_employee_department_and_name(self):
|
||||
for emp in self.stats_by_employee:
|
||||
emp_name = frappe.db.get_value(
|
||||
'Employee', emp, 'employee_name'
|
||||
)
|
||||
emp_dept = frappe.db.get_value(
|
||||
'Employee', emp, 'department'
|
||||
)
|
||||
|
||||
self.stats_by_employee[emp]['department'] = emp_dept
|
||||
self.stats_by_employee[emp]['employee_name'] = emp_name
|
||||
|
||||
def calculate_utilizations(self):
|
||||
TOTAL_HOURS = flt(self.standard_working_hours * self.day_span, 2)
|
||||
|
||||
@@ -20,6 +20,8 @@ class TestEmployeeUtilization(unittest.TestCase):
|
||||
# Create test timesheets
|
||||
cls.create_test_timesheets()
|
||||
|
||||
frappe.db.set_value("HR Settings", "HR Settings", "standard_working_hours", 9)
|
||||
|
||||
@classmethod
|
||||
def create_test_timesheets(cls):
|
||||
timesheet1 = frappe.new_doc("Timesheet")
|
||||
@@ -94,13 +96,13 @@ class TestEmployeeUtilization(unittest.TestCase):
|
||||
expected_data = [
|
||||
{
|
||||
'employee': self.test_emp1,
|
||||
'employee_name': emp1_data.employee_name,
|
||||
'department': emp1_data.department,
|
||||
'billed_hours': 5.0,
|
||||
'non_billed_hours': 0.0,
|
||||
'department': emp1_data.department,
|
||||
'total_hours': 18.0,
|
||||
'untracked_hours': 13.0,
|
||||
'per_util': 27.78
|
||||
'per_util': 27.78,
|
||||
'per_util_billed_only': 27.78
|
||||
}
|
||||
]
|
||||
|
||||
@@ -120,13 +122,13 @@ class TestEmployeeUtilization(unittest.TestCase):
|
||||
expected_data = [
|
||||
{
|
||||
'employee': self.test_emp2,
|
||||
'employee_name': emp2_data.employee_name,
|
||||
'department': emp2_data.department,
|
||||
'billed_hours': 0.0,
|
||||
'non_billed_hours': 10.0,
|
||||
'department': emp2_data.department,
|
||||
'total_hours': 18.0,
|
||||
'untracked_hours': 8.0,
|
||||
'per_util': 55.56
|
||||
'per_util': 55.56,
|
||||
'per_util_billed_only': 0.0
|
||||
}
|
||||
]
|
||||
|
||||
@@ -155,7 +157,7 @@ class TestEmployeeUtilization(unittest.TestCase):
|
||||
|
||||
report = execute(filters)
|
||||
summary = report[4]
|
||||
expected_summary_values = ['41.67%', 5.0, 10.0, 21.0]
|
||||
expected_summary_values = ['41.67%', '13.89%', 5.0, 10.0]
|
||||
|
||||
self.assertEqual(len(summary), 4)
|
||||
|
||||
@@ -171,22 +173,22 @@ class TestEmployeeUtilization(unittest.TestCase):
|
||||
return [
|
||||
{
|
||||
'employee': self.test_emp2,
|
||||
'employee_name': emp2_data.employee_name,
|
||||
'department': emp2_data.department,
|
||||
'billed_hours': 0.0,
|
||||
'non_billed_hours': 10.0,
|
||||
'department': emp2_data.department,
|
||||
'total_hours': 18.0,
|
||||
'untracked_hours': 8.0,
|
||||
'per_util': 55.56
|
||||
'per_util': 55.56,
|
||||
'per_util_billed_only': 0.0
|
||||
},
|
||||
{
|
||||
'employee': self.test_emp1,
|
||||
'employee_name': emp1_data.employee_name,
|
||||
'department': emp1_data.department,
|
||||
'billed_hours': 5.0,
|
||||
'non_billed_hours': 0.0,
|
||||
'department': emp1_data.department,
|
||||
'total_hours': 18.0,
|
||||
'untracked_hours': 13.0,
|
||||
'per_util': 27.78
|
||||
'per_util': 27.78,
|
||||
'per_util_billed_only': 27.78
|
||||
}
|
||||
]
|
||||
@@ -21,6 +21,8 @@ class TestProjectProfitability(unittest.TestCase):
|
||||
self.sales_invoice.due_date = nowdate()
|
||||
self.sales_invoice.submit()
|
||||
|
||||
frappe.db.set_value("HR Settings", "HR Settings", "standard_working_hours", 8)
|
||||
|
||||
def test_project_profitability(self):
|
||||
filters = {
|
||||
'company': '_Test Company',
|
||||
|
||||
Reference in New Issue
Block a user