From 9ac2fc932daa0966fb206ad470b431eb7c092f27 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 5 Oct 2016 12:20:25 +0530 Subject: [PATCH] Validate dates, fixes #6542 --- 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 a30a21b514..cb23ff848c 100644 --- a/erpnext/projects/doctype/timesheet/timesheet.py +++ b/erpnext/projects/doctype/timesheet/timesheet.py @@ -145,7 +145,7 @@ class Timesheet(Document): def validate_dates(self): for data in self.time_logs: - if time_diff_in_hours(data.to_time, data.from_time) < 0: + if data.from_time and data.to_time and time_diff_in_hours(data.to_time, data.from_time) < 0: frappe.throw(_("To date cannot be before from date")) def validate_time_logs(self):