From f622996c486d5ba4f9f5c3916e97fb5fcac34a0c Mon Sep 17 00:00:00 2001 From: Nishka Gosalia Date: Fri, 2 Jan 2026 16:50:20 +0530 Subject: [PATCH] fix: disallowing overlapping time logs in allow on submit mode --- .../projects/doctype/timesheet/test_timesheet.py | 15 +++++++++++++++ erpnext/projects/doctype/timesheet/timesheet.py | 1 + 2 files changed, 16 insertions(+) diff --git a/erpnext/projects/doctype/timesheet/test_timesheet.py b/erpnext/projects/doctype/timesheet/test_timesheet.py index 55d90e85c94..ed815c45884 100644 --- a/erpnext/projects/doctype/timesheet/test_timesheet.py +++ b/erpnext/projects/doctype/timesheet/test_timesheet.py @@ -172,6 +172,21 @@ class TestTimesheet(ERPNextTestSuite): settings.ignore_employee_time_overlap = 1 settings.save() timesheet.save() # should not throw an error + timesheet.submit() # should not throw an error + settings.ignore_employee_time_overlap = 0 + settings.save() + + timesheet.append( + "time_logs", + { + "billable": 1, + "activity_type": "_Test Activity Type", + "from_time": now_datetime(), + "to_time": now_datetime() + datetime.timedelta(hours=3), + "company": "_Test Company", + }, + ) + self.assertRaises(frappe.ValidationError, timesheet.submit) settings.ignore_employee_time_overlap = initial_setting settings.save() diff --git a/erpnext/projects/doctype/timesheet/timesheet.py b/erpnext/projects/doctype/timesheet/timesheet.py index d9ee987c8c2..866281bf1ef 100644 --- a/erpnext/projects/doctype/timesheet/timesheet.py +++ b/erpnext/projects/doctype/timesheet/timesheet.py @@ -79,6 +79,7 @@ class Timesheet(Document): def on_update_after_submit(self): self.validate_mandatory_fields() self.update_task_and_project() + self.validate_time_logs() def calculate_hours(self): for row in self.time_logs: