hello ,
is it possible to create employee check in and check by default based on certain shift type .
hello ,
is it possible to create employee check in and check by default based on certain shift type .
yes, you can
i used this to practice :
bench console
import frappe
from erpnext.hr.doctype.employee_checkin.employee_checkin import add_log_based_on_employee_field
add_log_based_on_employee_field(1062,‘2023-09-07 08:36:00.000000’,None,None,0)
frappe.db.commit()
and it worked , it added a record in employee checkin .
now i am trying to call this function in client script to add check in records for all people in certain shift type
can you give me a hint on how to do it , if you have knowledge about the problem .
thank you .
@santhida
frappe.listview_settings["Employee Checkin"] = {
refresh: function(listview) {
for (var i = 0; i < listview.data.length; i++) {
var row = listview.data[i];
let collection = document.getElementsByClassName("list-row-container");
var shift = row.shift;
var emp = row.employee;
var t = row.time;
if (emp == 6 && shift == "shift2"){
console.log("i am here");
frappe.call({
method: "erpnext.hr.doctype.employee_checkin.employee_checkin.add_log_based_on_employee_field",
args: {
employee_field_value: emp,
timestamp: '06-09-2023 16:00:00',
device_id: 'test3',
log_type: '',
skip_auto_attendance: 0,
employee_field_name: emp
},
callback: function (r) {
console.log(r.message);
}
})
}
}
}
}
i tried this code but it did not work .