Merge branch 'develop' of https://github.com/frappe/erpnext into fix-incorrect-translations
diff --git a/erpnext/hr/doctype/attendance/attendance.json b/erpnext/hr/doctype/attendance/attendance.json
index bc89b36..ab2dc4a 100644
--- a/erpnext/hr/doctype/attendance/attendance.json
+++ b/erpnext/hr/doctype/attendance/attendance.json
@@ -1,4 +1,5 @@
 {
+ "actions": [],
  "allow_import": 1,
  "autoname": "naming_series:",
  "creation": "2013-01-10 16:34:13",
@@ -64,6 +65,14 @@
    "oldfieldtype": "Data"
   },
   {
+   "depends_on": "working_hours",
+   "fieldname": "working_hours",
+   "fieldtype": "Float",
+   "label": "Working Hours",
+   "precision": "1",
+   "read_only": 1
+  },
+  {
    "default": "Present",
    "fieldname": "status",
    "fieldtype": "Select",
@@ -72,7 +81,7 @@
    "no_copy": 1,
    "oldfieldname": "status",
    "oldfieldtype": "Select",
-   "options": "\nPresent\nAbsent\nOn Leave\nHalf Day",
+   "options": "\nPresent\nAbsent\nOn Leave\nHalf Day\nWork From Home",
    "reqd": 1,
    "search_index": 1
   },
@@ -127,6 +136,12 @@
    "read_only": 1
   },
   {
+   "fieldname": "shift",
+   "fieldtype": "Link",
+   "label": "Shift",
+   "options": "Shift Type"
+  },
+  {
    "fieldname": "attendance_request",
    "fieldtype": "Link",
    "label": "Attendance Request",
@@ -144,20 +159,6 @@
    "read_only": 1
   },
   {
-   "depends_on": "working_hours",
-   "fieldname": "working_hours",
-   "fieldtype": "Float",
-   "label": "Working Hours",
-   "precision": "1",
-   "read_only": 1
-  },
-  {
-   "fieldname": "shift",
-   "fieldtype": "Link",
-   "label": "Shift",
-   "options": "Shift Type"
-  },
-  {
    "default": "0",
    "fieldname": "late_entry",
    "fieldtype": "Check",
@@ -173,7 +174,8 @@
  "icon": "fa fa-ok",
  "idx": 1,
  "is_submittable": 1,
- "modified": "2019-07-29 20:35:40.845422",
+ "links": [],
+ "modified": "2020-01-27 20:25:29.572281",
  "modified_by": "Administrator",
  "module": "HR",
  "name": "Attendance",
diff --git a/erpnext/hr/doctype/attendance/attendance.py b/erpnext/hr/doctype/attendance/attendance.py
index c3fbed5..9e965db 100644
--- a/erpnext/hr/doctype/attendance/attendance.py
+++ b/erpnext/hr/doctype/attendance/attendance.py
@@ -52,7 +52,7 @@
 
 	def validate(self):
 		from erpnext.controllers.status_updater import validate_status
-		validate_status(self.status, ["Present", "Absent", "On Leave", "Half Day"])
+		validate_status(self.status, ["Present", "Absent", "On Leave", "Half Day", "Work From Home"])
 		self.validate_attendance_date()
 		self.validate_duplicate_record()
 		self.check_leave_record()
diff --git a/erpnext/hr/doctype/attendance/attendance_list.js b/erpnext/hr/doctype/attendance/attendance_list.js
index 1161703..6df3dbd 100644
--- a/erpnext/hr/doctype/attendance/attendance_list.js
+++ b/erpnext/hr/doctype/attendance/attendance_list.js
@@ -1,7 +1,13 @@
 frappe.listview_settings['Attendance'] = {
 	add_fields: ["status", "attendance_date"],
-	get_indicator: function(doc) {
-		return [__(doc.status), doc.status=="Present" ? "green" : "darkgrey", "status,=," + doc.status];
+	get_indicator: function (doc) {
+		if (["Present", "Work From Home"].includes(doc.status)) {
+			return [__(doc.status), "green", "status,=," + doc.status];
+		} else if (["Absent", "On Leave"].includes(doc.status)) {
+			return [__(doc.status), "red", "status,=," + doc.status];
+		} else if (doc.status == "Half Day") {
+			return [__(doc.status), "orange", "status,=," + doc.status];
+		}
 	},
 	onload: function(list_view) {
 		let me = this;
@@ -44,7 +50,7 @@
 						label: __("Status"),
 						fieldtype: "Select",
 						fieldname: "status",
-						options: ["Present", "Absent", "Half Day"],
+						options: ["Present", "Absent", "Half Day", "Work From Home"],
 						hidden:1,
 						reqd: 1,
 
@@ -102,5 +108,4 @@
 			});
 		});
 	}
-
 };
diff --git a/erpnext/hr/doctype/employee_attendance_tool/employee_attendance_tool.js b/erpnext/hr/doctype/employee_attendance_tool/employee_attendance_tool.js
index 22ba5ad..3205a92 100644
--- a/erpnext/hr/doctype/employee_attendance_tool/employee_attendance_tool.js
+++ b/erpnext/hr/doctype/employee_attendance_tool/employee_attendance_tool.js
@@ -124,8 +124,10 @@
 
 		var mark_employee_toolbar = $('<div class="col-sm-12 bottom-toolbar">\
 			<button class="btn btn-primary btn-mark-present btn-xs"></button>\
-			<button class="btn btn-default btn-mark-absent btn-xs"></button>\
-			<button class="btn btn-default btn-mark-half-day btn-xs"></button></div>')
+			<button class="btn btn-primary btn-mark-work-from-home btn-xs"></button>\
+			<button class="btn btn-warning btn-mark-half-day btn-xs"></button>\
+			<button class="btn btn-danger btn-mark-absent btn-xs"></button>\
+			</div>');
 
 		employee_toolbar.find(".btn-add")
 			.html(__('Check all'))
@@ -224,6 +226,31 @@
 			});
 
 
+		mark_employee_toolbar.find(".btn-mark-work-from-home")
+			.html(__('Mark Work From Home'))
+			.on("click", function() {
+				var employee_work_from_home = [];
+				$(me.wrapper).find('input[type="checkbox"]').each(function(i, check) {
+					if($(check).is(":checked")) {
+						employee_work_from_home.push(employee[i]);
+					}
+				});
+				frappe.call({
+					method: "erpnext.hr.doctype.employee_attendance_tool.employee_attendance_tool.mark_employee_attendance",
+					args:{
+						"employee_list":employee_work_from_home,
+						"status":"Work From Home",
+						"date":frm.doc.date,
+						"company":frm.doc.company
+					},
+
+					callback: function(r) {
+						erpnext.employee_attendance_tool.load_employees(frm);
+
+					}
+				});
+			});
+
 		var row;
 		$.each(employee, function(i, m) {
 			if (i===0 || (i % 4) === 0) {