From cab8e9be891dfa102656723a7851eab5454938b5 Mon Sep 17 00:00:00 2001 From: Suraj Shetty Date: Wed, 7 Aug 2019 10:40:29 +0530 Subject: [PATCH] fix(timesheet): Hours automatically used to set 0 - Case: If the company had standard working hour set and when the user creates a timesheet with same date for "To" and "From" then the hours field automatically used to get reset to 0 after saving the form. --- erpnext/projects/doctype/timesheet/timesheet.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/projects/doctype/timesheet/timesheet.py b/erpnext/projects/doctype/timesheet/timesheet.py index df9a6baf38..3c719227bd 100644 --- a/erpnext/projects/doctype/timesheet/timesheet.py +++ b/erpnext/projects/doctype/timesheet/timesheet.py @@ -96,7 +96,7 @@ class Timesheet(Document): for time in self.time_logs: if time.from_time and time.to_time: - if flt(std_working_hours) > 0: + if flt(std_working_hours) and date_diff(time.to_time, time.from_time): time.hours = flt(std_working_hours) * date_diff(time.to_time, time.from_time) else: if not time.hours: