From ccb15de1c9e4c23487787b3f8be3bf3e8d7dfb86 Mon Sep 17 00:00:00 2001 From: Hussain Nagaria Date: Mon, 5 Apr 2021 11:23:06 +0530 Subject: [PATCH] fix: Handle overtime edge case --- .../employee_hours_utilisation_based_on_timesheet.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/erpnext/projects/report/employee_hours_utilisation_based_on_timesheet/employee_hours_utilisation_based_on_timesheet.py b/erpnext/projects/report/employee_hours_utilisation_based_on_timesheet/employee_hours_utilisation_based_on_timesheet.py index c27efc96fb..19cb1c911d 100644 --- a/erpnext/projects/report/employee_hours_utilisation_based_on_timesheet/employee_hours_utilisation_based_on_timesheet.py +++ b/erpnext/projects/report/employee_hours_utilisation_based_on_timesheet/employee_hours_utilisation_based_on_timesheet.py @@ -134,6 +134,11 @@ class EmployeeHoursReport: for emp, data in iteritems(self.stats_by_employee): data['total_hours'] = TOTAL_HOURS data['untracked_hours'] = flt(TOTAL_HOURS - data['billed_hours'] - data['non_billed_hours'], 2) + + # To handle overtime edge-case + if data['untracked_hours'] < 0: + data['untracked_hours'] = 0.0 + data['per_util'] = flt(((data['billed_hours'] + data['non_billed_hours']) / TOTAL_HOURS) * 100, 2) def generate_report_summary(self):