mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-02 19:59:12 +00:00
fix: fixed test and resolved conflicts
This commit is contained in:
@@ -31,7 +31,10 @@ class EmployeeCheckin(Document):
|
|||||||
|
|
||||||
def fetch_shift(self):
|
def fetch_shift(self):
|
||||||
shift_actual_timings = get_actual_start_end_datetime_of_shift(self.employee, get_datetime(self.time), True)
|
shift_actual_timings = get_actual_start_end_datetime_of_shift(self.employee, get_datetime(self.time), True)
|
||||||
if not frappe.db.get_value("Shift Type", shift_actual_timings[2].shift_type.name, "allow_overtime"):
|
allow_overtime = False
|
||||||
|
if shift_actual_timings[2]:
|
||||||
|
allow_overtime = frappe.db.get_value("Shift Type", shift_actual_timings[2].shift_type.name, "allow_overtime")
|
||||||
|
if not allow_overtime:
|
||||||
if shift_actual_timings[0] and shift_actual_timings[1]:
|
if shift_actual_timings[0] and shift_actual_timings[1]:
|
||||||
if shift_actual_timings[2].shift_type.determine_check_in_and_check_out == 'Strictly based on Log Type in Employee Checkin' and not self.log_type and not self.skip_auto_attendance:
|
if shift_actual_timings[2].shift_type.determine_check_in_and_check_out == 'Strictly based on Log Type in Employee Checkin' and not self.log_type and not self.skip_auto_attendance:
|
||||||
frappe.throw(_('Log Type is required for check-ins falling in the shift: {0}.').format(shift_actual_timings[2].shift_type.name))
|
frappe.throw(_('Log Type is required for check-ins falling in the shift: {0}.').format(shift_actual_timings[2].shift_type.name))
|
||||||
@@ -41,7 +44,7 @@ class EmployeeCheckin(Document):
|
|||||||
self.shift_actual_end = shift_actual_timings[1]
|
self.shift_actual_end = shift_actual_timings[1]
|
||||||
self.shift_start = shift_actual_timings[2].start_datetime
|
self.shift_start = shift_actual_timings[2].start_datetime
|
||||||
self.shift_end = shift_actual_timings[2].end_datetime
|
self.shift_end = shift_actual_timings[2].end_datetime
|
||||||
elif frappe.db.get_value("Shift Type", shift_actual_timings[2].shift_type.name, "allow_overtime"):
|
elif allow_overtime:
|
||||||
#because after Actual time it takes check-in/out invalid
|
#because after Actual time it takes check-in/out invalid
|
||||||
#if employee checkout late or check-in before before shift timing adding time buffer.
|
#if employee checkout late or check-in before before shift timing adding time buffer.
|
||||||
self.shift = shift_actual_timings[2].shift_type.name
|
self.shift = shift_actual_timings[2].shift_type.name
|
||||||
@@ -81,7 +84,6 @@ def add_log_based_on_employee_field(employee_field_value, timestamp, device_id=N
|
|||||||
|
|
||||||
return doc
|
return doc
|
||||||
|
|
||||||
|
|
||||||
def mark_attendance_and_link_log(logs, attendance_status, attendance_date, working_hours=None, late_entry=False, early_exit=False, in_time=None, out_time=None, shift=None):
|
def mark_attendance_and_link_log(logs, attendance_status, attendance_date, working_hours=None, late_entry=False, early_exit=False, in_time=None, out_time=None, shift=None):
|
||||||
"""Creates an attendance and links the attendance to the Employee Checkin.
|
"""Creates an attendance and links the attendance to the Employee Checkin.
|
||||||
Note: If attendance is already present for the given date, the logs are marked as skipped and no exception is thrown.
|
Note: If attendance is already present for the given date, the logs are marked as skipped and no exception is thrown.
|
||||||
@@ -109,7 +111,6 @@ def mark_attendance_and_link_log(logs, attendance_status, attendance_date, worki
|
|||||||
working_timedelta = timedelta(hours =int(working_time[1]), minutes = int(working_time[0] * 60))
|
working_timedelta = timedelta(hours =int(working_time[1]), minutes = int(working_time[0] * 60))
|
||||||
from erpnext.hr.doctype.shift_type.shift_type import convert_time_into_duration
|
from erpnext.hr.doctype.shift_type.shift_type import convert_time_into_duration
|
||||||
working_time = convert_time_into_duration(working_timedelta)
|
working_time = convert_time_into_duration(working_timedelta)
|
||||||
|
|
||||||
doc_dict = {
|
doc_dict = {
|
||||||
'doctype': 'Attendance',
|
'doctype': 'Attendance',
|
||||||
'employee': employee,
|
'employee': employee,
|
||||||
|
|||||||
@@ -40,7 +40,8 @@ class TestEmployeeCheckin(unittest.TestCase):
|
|||||||
log_names = [log.name for log in logs]
|
log_names = [log.name for log in logs]
|
||||||
logs_count = frappe.db.count('Employee Checkin', {'name':['in', log_names], 'attendance':attendance.name})
|
logs_count = frappe.db.count('Employee Checkin', {'name':['in', log_names], 'attendance':attendance.name})
|
||||||
self.assertEqual(logs_count, 4)
|
self.assertEqual(logs_count, 4)
|
||||||
attendance_count = frappe.db.count('Attendance', {'status':'Present', 'working_hours':8.2,
|
|
||||||
|
attendance_count = frappe.db.count('Attendance', {'status':'Present', 'working_time': 29460,
|
||||||
'employee':employee, 'attendance_date':now_date})
|
'employee':employee, 'attendance_date':now_date})
|
||||||
self.assertEqual(attendance_count, 1)
|
self.assertEqual(attendance_count, 1)
|
||||||
|
|
||||||
|
|||||||
@@ -257,7 +257,7 @@ def get_actual_start_end_datetime_of_shift(employee, for_datetime, consider_defa
|
|||||||
actual_shift_start = actual_shift_end = shift_details = None
|
actual_shift_start = actual_shift_end = shift_details = None
|
||||||
shift_timings_as_per_timestamp = get_employee_shift_timings(employee, for_datetime, consider_default_shift)
|
shift_timings_as_per_timestamp = get_employee_shift_timings(employee, for_datetime, consider_default_shift)
|
||||||
|
|
||||||
if not shift_timings_as_per_timestamp[0].allow_overtime:
|
if shift_timings_as_per_timestamp[0] and not shift_timings_as_per_timestamp[0].allow_overtime:
|
||||||
# If Shift is not allowed for automatic calculation of overtime, then previous, current and next
|
# If Shift is not allowed for automatic calculation of overtime, then previous, current and next
|
||||||
# shift will also should be considered for valid and invalid checkins.
|
# shift will also should be considered for valid and invalid checkins.
|
||||||
# if checkin time is not in current shift thenit will check prev and next shift for checkin validation.
|
# if checkin time is not in current shift thenit will check prev and next shift for checkin validation.
|
||||||
|
|||||||
@@ -569,8 +569,8 @@ class SalarySlip(TransactionBase):
|
|||||||
frappe.bold(detail.overtime_type)))
|
frappe.bold(detail.overtime_type)))
|
||||||
|
|
||||||
if "applicable_amount" not in overtime_types_details[detail.overtime_type].keys():
|
if "applicable_amount" not in overtime_types_details[detail.overtime_type].keys():
|
||||||
component_amount = sum([data.default_amount for data in self.earnings if data.salary_component in \
|
component_amount = sum([data.default_amount for data in self.earnings if data.salary_component in
|
||||||
overtime_types_details[detail.overtime_type]["components"] and not data.get('additional_salary', None)])
|
overtime_types_details[detail.overtime_type]["components"] and not data.get('additional_salary', None)])
|
||||||
|
|
||||||
overtime_types_details[detail.overtime_type]["applicable_daily_amount"] = component_amount/self.total_working_days
|
overtime_types_details[detail.overtime_type]["applicable_daily_amount"] = component_amount/self.total_working_days
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user