Merge pull request #3651 from rmehta/pos-default-pay-fix

[fix] pos default payment #3631
diff --git a/erpnext/accounts/doctype/accounts_settings/accounts_settings.json b/erpnext/accounts/doctype/accounts_settings/accounts_settings.json
index 231c8ab..cdb32dc 100644
--- a/erpnext/accounts/doctype/accounts_settings/accounts_settings.json
+++ b/erpnext/accounts/doctype/accounts_settings/accounts_settings.json
@@ -5,13 +5,6 @@
  "doctype": "DocType", 
  "fields": [
   {
-   "fieldname": "check_supplier_invoice_uniqueness", 
-   "fieldtype": "Check", 
-   "label": "Check Supplier Invoice Number Uniqueness", 
-   "permlevel": 0, 
-   "precision": ""
-  }, 
-  {
    "default": "1", 
    "description": "If enabled, the system will post accounting entries for inventory automatically.", 
    "fieldname": "auto_accounting_for_stock", 
@@ -45,12 +38,19 @@
    "label": "Credit Controller", 
    "options": "Role", 
    "permlevel": 0
+  }, 
+  {
+   "fieldname": "check_supplier_invoice_uniqueness", 
+   "fieldtype": "Check", 
+   "label": "Check Supplier Invoice Number Uniqueness", 
+   "permlevel": 0, 
+   "precision": ""
   }
  ], 
  "icon": "icon-cog", 
  "idx": 1, 
  "issingle": 1, 
- "modified": "2015-06-11 06:06:34.047890", 
+ "modified": "2015-07-14 00:51:48.095525", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Accounts Settings", 
diff --git a/erpnext/projects/doctype/project/project.js b/erpnext/projects/doctype/project/project.js
index aa55876..8999f85 100644
--- a/erpnext/projects/doctype/project/project.js
+++ b/erpnext/projects/doctype/project/project.js
@@ -26,22 +26,29 @@
 // show tasks
 cur_frm.cscript.refresh = function(doc) {
 	if(!doc.__islocal) {
-		cur_frm.add_custom_button(__("Gantt Chart"), function() {
-			frappe.route_options = {"project": doc.name, "start": doc.expected_start_date, "end": doc.expected_end_date};
-			frappe.set_route("Gantt", "Task");
-		}, "icon-tasks", true);
-		cur_frm.add_custom_button(__("Tasks"), function() {
-			frappe.route_options = {"project": doc.name}
-			frappe.set_route("List", "Task");
-		}, "icon-list", true);
-		cur_frm.add_custom_button(__("Time Logs"), function() {
-			frappe.route_options = {"project": doc.name}
-			frappe.set_route("List", "Time Log");
-		}, "icon-list", true);
-		cur_frm.add_custom_button(__("Expense Claims"), function() {
-			frappe.route_options = {"project": doc.name}
-			frappe.set_route("List", "Expense Claim");
-		}, "icon-list", true);
+		if(frappe.model.can_read("Task")) {
+			cur_frm.add_custom_button(__("Gantt Chart"), function() {
+				frappe.route_options = {"project": doc.name, "start": doc.expected_start_date, "end": doc.expected_end_date};
+				frappe.set_route("Gantt", "Task");
+			}, "icon-tasks", true);
+			cur_frm.add_custom_button(__("Tasks"), function() {
+				frappe.route_options = {"project": doc.name}
+				frappe.set_route("List", "Task");
+			}, "icon-list", true);
+		}
+		if(frappe.model.can_read("Time Log")) {
+			cur_frm.add_custom_button(__("Time Logs"), function() {
+				frappe.route_options = {"project": doc.name}
+				frappe.set_route("List", "Time Log");
+			}, "icon-list", true);
+		}
+
+		if(frappe.model.can_read("Expense Claim")) {
+			cur_frm.add_custom_button(__("Expense Claims"), function() {
+				frappe.route_options = {"project": doc.name}
+				frappe.set_route("List", "Expense Claim");
+			}, "icon-list", true);
+		}
 	}
 }
 
@@ -56,5 +63,5 @@
 		filters:{
 			'project_name': doc.name
 		}
-	}	
+	}
 }
diff --git a/erpnext/projects/doctype/time_log/time_log.js b/erpnext/projects/doctype/time_log/time_log.js
index 536ddf8..776a75b 100644
--- a/erpnext/projects/doctype/time_log/time_log.js
+++ b/erpnext/projects/doctype/time_log/time_log.js
@@ -42,7 +42,7 @@
 frappe.ui.form.on("Time Log", "to_time", function(frm) {
 	if(frm._setting_hours) return;
 	frm.set_value("hours", moment(cur_frm.doc.to_time).diff(moment(cur_frm.doc.from_time),
-		"hours"));
+		"minutes") / 60);
 
 });
 
@@ -98,5 +98,5 @@
 		filters:{
 			'project': doc.project
 		}
-	}	
+	}
 }
diff --git a/erpnext/projects/doctype/time_log/time_log.py b/erpnext/projects/doctype/time_log/time_log.py
index 841ef28..136362b 100644
--- a/erpnext/projects/doctype/time_log/time_log.py
+++ b/erpnext/projects/doctype/time_log/time_log.py
@@ -73,18 +73,20 @@
 	def validate_overlap_for(self, fieldname):
 		existing = self.get_overlap_for(fieldname)
 		if existing:
-			frappe.throw(_("This Time Log conflicts with {0} for {1}").format(existing.name,
-				self.meta.get_label(fieldname)), OverlapError)
+			frappe.throw(_("This Time Log conflicts with {0} for {1} {2}").format(existing.name,
+				self.meta.get_label(fieldname), self.get(fieldname)), OverlapError)
 
 	def get_overlap_for(self, fieldname):
 		if not self.get(fieldname):
 			return
 
-		existing = frappe.db.sql("""select name, from_time, to_time from `tabTime Log` where `{0}`=%(val)s and
+		existing = frappe.db.sql("""select name, from_time, to_time from `tabTime Log`
+			where `{0}`=%(val)s and
 			(
-				(from_time between %(from_time)s and %(to_time)s) or
-				(to_time between %(from_time)s and %(to_time)s) or
-				(%(from_time)s between from_time and to_time))
+				(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))
 			and name!=%(name)s
 			and ifnull(task, "")=%(task)s
 			and docstatus < 2""".format(fieldname),
diff --git a/erpnext/setup/doctype/notification_control/notification_control.json b/erpnext/setup/doctype/notification_control/notification_control.json
index f81801d..a77fe67 100644
--- a/erpnext/setup/doctype/notification_control/notification_control.json
+++ b/erpnext/setup/doctype/notification_control/notification_control.json
@@ -176,20 +176,13 @@
  "icon": "icon-envelope", 
  "idx": 1, 
  "issingle": 1, 
- "modified": "2015-03-04 01:13:46.715113", 
+ "modified": "2015-07-13 06:24:05.436127", 
  "modified_by": "Administrator", 
  "module": "Setup", 
  "name": "Notification Control", 
  "owner": "Administrator", 
  "permissions": [
   {
-   "create": 0, 
-   "permlevel": 0, 
-   "read": 1, 
-   "role": "Guest", 
-   "write": 0
-  }, 
-  {
    "create": 1, 
    "permlevel": 0, 
    "read": 1,