diff --git a/erpnext/projects/doctype/timesheet_detail/timesheet_detail.py b/erpnext/projects/doctype/timesheet_detail/timesheet_detail.py index 5f367428644..3dbb8614fa4 100644 --- a/erpnext/projects/doctype/timesheet_detail/timesheet_detail.py +++ b/erpnext/projects/doctype/timesheet_detail/timesheet_detail.py @@ -5,7 +5,7 @@ import frappe from frappe import _ from frappe.model.document import Document -from frappe.utils import add_to_date, flt, get_datetime, time_diff_in_hours +from frappe.utils import add_to_date, flt, get_datetime, time_diff_in_hours, time_diff_in_seconds class TimesheetDetail(Document): @@ -48,7 +48,9 @@ class TimesheetDetail(Document): if not (self.from_time and self.hours): return - self.to_time = get_datetime(add_to_date(self.from_time, hours=self.hours, as_datetime=True)) + _to_time = get_datetime(add_to_date(self.from_time, hours=self.hours, as_datetime=True)) + if abs(time_diff_in_seconds(_to_time, self.to_time)) >= 1: + self.to_time = _to_time def set_project(self): """Set project based on task."""