fix(HR): changes as per PR review
> renamed 'Employee Checkin Log' DocType to 'Employee_attendance_log' DocType
> renamed biometric_id to biometric_rf_if
diff --git a/erpnext/hr/doctype/employee/employee.json b/erpnext/hr/doctype/employee/employee.json
index 6cd4710..d138418 100644
--- a/erpnext/hr/doctype/employee/employee.json
+++ b/erpnext/hr/doctype/employee/employee.json
@@ -16,7 +16,7 @@
"middle_name",
"last_name",
"employee_name",
- "biometric_id",
+ "biometric_rf_id",
"image",
"column_break1",
"company",
@@ -749,7 +749,7 @@
"label": "Old Parent"
},
{
- "fieldname": "biometric_id",
+ "fieldname": "biometric_rf_id",
"fieldtype": "Data",
"label": "Biometric/RF tag ID ",
"no_copy": 1,
@@ -759,7 +759,7 @@
"icon": "fa fa-user",
"idx": 24,
"image_field": "image",
- "modified": "2019-05-08 10:53:50.897464",
+ "modified": "2019-05-08 14:32:06.443825",
"modified_by": "Administrator",
"module": "HR",
"name": "Employee",
diff --git a/erpnext/hr/doctype/employee_checkin_log/__init__.py b/erpnext/hr/doctype/employee_attendance_log/__init__.py
similarity index 100%
rename from erpnext/hr/doctype/employee_checkin_log/__init__.py
rename to erpnext/hr/doctype/employee_attendance_log/__init__.py
diff --git a/erpnext/hr/doctype/employee_checkin_log/employee_checkin_log.js b/erpnext/hr/doctype/employee_attendance_log/employee_attendance_log.js
similarity index 77%
rename from erpnext/hr/doctype/employee_checkin_log/employee_checkin_log.js
rename to erpnext/hr/doctype/employee_attendance_log/employee_attendance_log.js
index eb2a21b..55021f6 100644
--- a/erpnext/hr/doctype/employee_checkin_log/employee_checkin_log.js
+++ b/erpnext/hr/doctype/employee_attendance_log/employee_attendance_log.js
@@ -1,7 +1,7 @@
// Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and contributors
// For license information, please see license.txt
-frappe.ui.form.on('Employee Checkin Log', {
+frappe.ui.form.on('Employee Attendance Log', {
// refresh: function(frm) {
// }
diff --git a/erpnext/hr/doctype/employee_checkin_log/employee_checkin_log.json b/erpnext/hr/doctype/employee_attendance_log/employee_attendance_log.json
similarity index 93%
rename from erpnext/hr/doctype/employee_checkin_log/employee_checkin_log.json
rename to erpnext/hr/doctype/employee_attendance_log/employee_attendance_log.json
index 363c502..ccdb83d 100644
--- a/erpnext/hr/doctype/employee_checkin_log/employee_checkin_log.json
+++ b/erpnext/hr/doctype/employee_attendance_log/employee_attendance_log.json
@@ -1,6 +1,6 @@
{
"allow_import": 1,
- "autoname": "EMP-CHECKIN-.MM.-.YYYY.-.######",
+ "autoname": "EMP-ATT-LOG-.MM.-.YYYY.-.######",
"creation": "2019-04-25 10:17:11.225671",
"doctype": "DocType",
"engine": "InnoDB",
@@ -74,10 +74,10 @@
"options": "\nIN\nOUT"
}
],
- "modified": "2019-05-08 11:07:56.885960",
+ "modified": "2019-05-08 14:10:22.468252",
"modified_by": "Administrator",
"module": "HR",
- "name": "Employee Checkin Log",
+ "name": "Employee Attendance Log",
"owner": "Administrator",
"permissions": [
{
diff --git a/erpnext/hr/doctype/employee_attendance_log/employee_attendance_log.py b/erpnext/hr/doctype/employee_attendance_log/employee_attendance_log.py
new file mode 100644
index 0000000..6603b1c
--- /dev/null
+++ b/erpnext/hr/doctype/employee_attendance_log/employee_attendance_log.py
@@ -0,0 +1,42 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+import frappe
+from frappe.utils import now
+from frappe.model.document import Document
+from frappe import _
+
+class EmployeeAttendanceLog(Document):
+ pass
+
+
+@frappe.whitelist()
+def add_log_based_on_biometric_rf_id(biometric_rf_id, timestamp, device_id=None, log_type=None):
+ """Finds the relevant Employee using the biometric_rf_id and creates a Employee Attendance Log.
+
+ :param biometric_rf_id: The Biometric/RF tag ID as set up in Employee DocType.
+ :param timestamp: The timestamp of the Log. Currently expected in the following format as string: '2019-05-08 10:48:08.000000'
+ :param device_id(optional): Location / Device ID. A short string is expected.
+ :param log_type(optional): Direction of the Punch if available (IN/OUT).
+ """
+
+ if not biometric_rf_id or not timestamp:
+ frappe.throw(_("'biometric_rf_id' and 'timestamp' are required."))
+
+ employee = frappe.db.get_values("Employee", {"biometric_rf_id": biometric_rf_id},["name","employee_name","biometric_rf_id"],as_dict=True)
+ if len(employee) != 0:
+ employee = employee[0]
+ else:
+ frappe.throw(_("No Employee found for the given 'biometric_rf_id'."))
+
+ doc = frappe.new_doc("Employee Attendance Log")
+ doc.employee = employee.name
+ doc.employee_name = employee.employee_name
+ doc.time = timestamp
+ doc.device_id = device_id
+ doc.log_type = log_type
+ doc.save()
+
+ return doc
diff --git a/erpnext/hr/doctype/employee_attendance_log/test_employee_attendance_log.py b/erpnext/hr/doctype/employee_attendance_log/test_employee_attendance_log.py
new file mode 100644
index 0000000..45c1353
--- /dev/null
+++ b/erpnext/hr/doctype/employee_attendance_log/test_employee_attendance_log.py
@@ -0,0 +1,21 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and Contributors
+# See license.txt
+from __future__ import unicode_literals
+
+from erpnext.hr.doctype.employee_attendance_log.employee_attendance_log import add_log_based_on_biometric_rf_id
+
+import frappe
+import unittest
+
+class TestEmployeeAttendanceLog(unittest.TestCase):
+ def test_add_log_based_on_biometric_rf_id(self):
+ employee = frappe.get_doc("Employee", frappe.db.sql_list("select name from tabEmployee limit 1")[0])
+ employee.biometric_rf_id = '12349'
+ employee.save()
+
+ employee_attendance_log = add_log_based_on_biometric_rf_id('12349', '2019-05-08 10:48:08.000000', 'mumbai_first_floor', 'IN')
+ self.assertTrue(employee_attendance_log.employee == employee.name)
+ self.assertTrue(employee_attendance_log.time == '2019-05-08 10:48:08.000000')
+ self.assertTrue(employee_attendance_log.device_id == 'mumbai_first_floor')
+ self.assertTrue(employee_attendance_log.log_type == 'IN')
diff --git a/erpnext/hr/doctype/employee_checkin_log/employee_checkin_log.py b/erpnext/hr/doctype/employee_checkin_log/employee_checkin_log.py
deleted file mode 100644
index c7dec05..0000000
--- a/erpnext/hr/doctype/employee_checkin_log/employee_checkin_log.py
+++ /dev/null
@@ -1,42 +0,0 @@
-# -*- coding: utf-8 -*-
-# Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and contributors
-# For license information, please see license.txt
-
-from __future__ import unicode_literals
-import frappe
-from frappe.utils import now
-from frappe.model.document import Document
-from frappe import _
-
-class EmployeeCheckinLog(Document):
- pass
-
-
-@frappe.whitelist()
-def add_employee_checkin_log_based_on_biometric_id(biometric_id, timestamp, device_id=None, log_type=None):
- """Finds the relevant Employee using the biometric_id and creates a Employee Checkin Log.
-
- :param biometric_id: The Biometric/RF tag ID as set up in Employee DocType.
- :param timestamp: The timestamp of the Log. Currently expected in the following format as string: '2019-05-08 10:48:08.000000'
- :param device_id(optional): Location / Device ID. A short string is expected.
- :param log_type(optional): Direction of the Check-in if available (IN/OUT).
- """
-
- if not biometric_id or not timestamp:
- frappe.throw(_("'biometric_id' and 'timestamp' are required."))
-
- employee = frappe.db.get_values("Employee", {"biometric_id": biometric_id},["name","employee_name","biometric_id"],as_dict=True)
- if len(employee) != 0:
- employee = employee[0]
- else:
- frappe.throw(_("No Employee found for the given 'biometric_id'."))
-
- doc = frappe.new_doc("Employee Checkin Log")
- doc.employee = employee.name
- doc.employee_name = employee.employee_name
- doc.time = timestamp
- doc.device_id = device_id
- doc.log_type = log_type
- doc.save()
-
- return doc
diff --git a/erpnext/hr/doctype/employee_checkin_log/test_employee_checkin_log.py b/erpnext/hr/doctype/employee_checkin_log/test_employee_checkin_log.py
deleted file mode 100644
index f7ae775..0000000
--- a/erpnext/hr/doctype/employee_checkin_log/test_employee_checkin_log.py
+++ /dev/null
@@ -1,21 +0,0 @@
-# -*- coding: utf-8 -*-
-# Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and Contributors
-# See license.txt
-from __future__ import unicode_literals
-
-from erpnext.hr.doctype.employee_checkin_log.employee_checkin_log import add_employee_checkin_log_based_on_biometric_id
-
-import frappe
-import unittest
-
-class TestEmployeeCheckinLog(unittest.TestCase):
- def test_add_employee_checkin_log_based_on_biometric_id(self):
- employee = frappe.get_doc("Employee", frappe.db.sql_list("select name from tabEmployee limit 1")[0])
- employee.biometric_id = '12349'
- employee.save()
-
- checkin_log = add_employee_checkin_log_based_on_biometric_id('12349', '2019-05-08 10:48:08.000000', 'mumbai_first_floor', 'IN')
- self.assertTrue(checkin_log.employee == employee.name)
- self.assertTrue(checkin_log.time == '2019-05-08 10:48:08.000000')
- self.assertTrue(checkin_log.device_id == 'mumbai_first_floor')
- self.assertTrue(checkin_log.log_type == 'IN')