Fixed time log overlap validation. Fixed test case in time log
diff --git a/erpnext/projects/doctype/time_log/test_time_log.py b/erpnext/projects/doctype/time_log/test_time_log.py
index 1894e37..8d5694f 100644
--- a/erpnext/projects/doctype/time_log/test_time_log.py
+++ b/erpnext/projects/doctype/time_log/test_time_log.py
@@ -105,7 +105,7 @@
task_name = frappe.db.get_value("Task",{"project": "_Test Project 1"})
time_log = make_time_log_test_record(employee="_T-Employee-0002", hours=2,
- task=task_name)
+ task=task_name, simulate=1)
self.assertEqual(time_log.costing_rate, 50)
self.assertEqual(time_log.costing_amount, 100)
self.assertEqual(time_log.billing_rate, 100)
@@ -115,7 +115,7 @@
self.assertEqual(frappe.db.get_value("Project", "_Test Project 1", "total_billing_amount"), 200)
time_log2 = make_time_log_test_record(employee="_T-Employee-0002",
- hours=2, task= task_name, from_time = now_datetime() + datetime.timedelta(hours= 3))
+ hours=2, task= task_name, from_time = now_datetime() + datetime.timedelta(hours= 3), simulate=1)
self.assertEqual(frappe.db.get_value("Task", task_name, "total_billing_amount"), 400)
self.assertEqual(frappe.db.get_value("Project", "_Test Project 1", "total_billing_amount"), 400)
diff --git a/erpnext/projects/doctype/time_log/time_log.py b/erpnext/projects/doctype/time_log/time_log.py
index c2239df..6763209 100644
--- a/erpnext/projects/doctype/time_log/time_log.py
+++ b/erpnext/projects/doctype/time_log/time_log.py
@@ -4,7 +4,7 @@
from __future__ import unicode_literals
import frappe
from frappe import _
-from frappe.utils import cstr, flt, get_datetime, get_time, getdate
+from frappe.utils import flt, get_datetime, get_time, getdate
from dateutil.relativedelta import relativedelta
from erpnext.manufacturing.doctype.manufacturing_settings.manufacturing_settings import get_mins_between_operations
@@ -93,14 +93,12 @@
(%(from_time)s > from_time and %(from_time)s < to_time) or
(%(from_time)s = from_time and %(to_time)s = to_time))
and name!=%(name)s
- and ifnull(task, "")=%(task)s
and docstatus < 2""".format(fieldname),
{
"val": self.get(fieldname),
"from_time": self.from_time,
"to_time": self.to_time,
- "name": self.name or "No Name",
- "task": cstr(self.task)
+ "name": self.name or "No Name"
}, as_dict=True)
return existing[0] if existing else None