Merge branch 'develop' into fix-incorrect-translations

This commit is contained in:
Suraj Shetty 2020-01-29 22:11:39 +05:30 committed by GitHub
commit f01c3f11c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 57 additions and 23 deletions

View File

@ -1,4 +1,5 @@
{
"actions": [],
"allow_import": 1,
"autoname": "naming_series:",
"creation": "2013-01-10 16:34:13",
@ -63,6 +64,14 @@
"oldfieldname": "employee_name",
"oldfieldtype": "Data"
},
{
"depends_on": "working_hours",
"fieldname": "working_hours",
"fieldtype": "Float",
"label": "Working Hours",
"precision": "1",
"read_only": 1
},
{
"default": "Present",
"fieldname": "status",
@ -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
},
@ -126,6 +135,12 @@
"options": "Department",
"read_only": 1
},
{
"fieldname": "shift",
"fieldtype": "Link",
"label": "Shift",
"options": "Shift Type"
},
{
"fieldname": "attendance_request",
"fieldtype": "Link",
@ -143,20 +158,6 @@
"print_hide": 1,
"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",
@ -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",

View File

@ -52,7 +52,7 @@ class Attendance(Document):
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()

View File

@ -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 @@ frappe.listview_settings['Attendance'] = {
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 @@ frappe.listview_settings['Attendance'] = {
});
});
}
};

View File

@ -124,8 +124,10 @@ erpnext.EmployeeSelector = Class.extend({
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 @@ erpnext.EmployeeSelector = Class.extend({
});
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) {