Merge branch 'develop'
diff --git a/erpnext/__version__.py b/erpnext/__version__.py
index c523351..6dfe2fe 100644
--- a/erpnext/__version__.py
+++ b/erpnext/__version__.py
@@ -1,2 +1,2 @@
 from __future__ import unicode_literals
-__version__ = '6.23.4'
+__version__ = '6.23.5'
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
index 358cf39..50a50d9 100644
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
@@ -28,7 +28,7 @@
 					this.frm.add_custom_button(__('Payment'), this.make_bank_entry, __("Make"));
 					cur_frm.page.set_inner_btn_group_as_primary(__("Make"));
 				}
-				if(Math.abs(flt(doc.outstanding_amount)) < flt(doc.grand_total)) {
+				if(doc.outstanding_amount >= 0 || Math.abs(flt(doc.outstanding_amount)) < flt(doc.grand_total)) {
 					cur_frm.add_custom_button(__('Debit Note'), this.make_debit_note, __("Make"));
 				}
 			}
diff --git a/erpnext/hooks.py b/erpnext/hooks.py
index f783fdf..d7eb5f4 100644
--- a/erpnext/hooks.py
+++ b/erpnext/hooks.py
@@ -7,7 +7,7 @@
 app_description = """ERP made simple"""
 app_icon = "icon-th"
 app_color = "#e74c3c"
-app_version = "6.23.4"
+app_version = "6.23.5"
 app_email = "info@erpnext.com"
 app_license = "GNU General Public License (v3)"
 source_link = "https://github.com/frappe/erpnext"
diff --git a/erpnext/projects/doctype/time_log/time_log.py b/erpnext/projects/doctype/time_log/time_log.py
index 6763209..5242b2c 100644
--- a/erpnext/projects/doctype/time_log/time_log.py
+++ b/erpnext/projects/doctype/time_log/time_log.py
@@ -88,10 +88,9 @@
 		existing = frappe.db.sql("""select name, from_time, to_time from `tabTime Log`
 			where `{0}`=%(val)s and
 			(
-				(from_time > %(from_time)s and from_time < %(to_time)s) or
-				(to_time > %(from_time)s and to_time < %(to_time)s) or
-				(%(from_time)s > from_time and %(from_time)s < to_time) or
-				(%(from_time)s = from_time and %(to_time)s = to_time))
+				(%(from_time)s between from_time and to_time) or 
+				(%(to_time)s between from_time and to_time) or 
+				(%(from_time)s <= from_time and %(to_time)s >= to_time))
 			and name!=%(name)s
 			and docstatus < 2""".format(fieldname),
 			{
diff --git a/setup.py b/setup.py
index c0431c2..70e8e3e 100644
--- a/setup.py
+++ b/setup.py
@@ -1,7 +1,7 @@
 from setuptools import setup, find_packages
 from pip.req import parse_requirements
 
-version = "6.23.4"
+version = "6.23.5"
 requirements = parse_requirements("requirements.txt", session="")
 
 setup(