diff --git a/yuthon_hr_attendance/controllers/applet_attendance.py b/yuthon_hr_attendance/controllers/applet_attendance.py index e7ca6259a..889422d8f 100644 --- a/yuthon_hr_attendance/controllers/applet_attendance.py +++ b/yuthon_hr_attendance/controllers/applet_attendance.py @@ -1161,8 +1161,12 @@ class AppletAttendance(Controller): 'current_read': clean_floats(record.current_read), 'current_meter': clean_floats(record.current_meter) } - if record.archives_id.name not in code_list: - code_list.append(record.archives_id.name) + if type == 'water': + current_name = record.water_id.name if record.water_id else '' + else: + current_name = record.archives_id.name if record.archives_id else '' + if current_name and current_name not in code_list: + code_list.append(current_name) result.append(tvalue) return json.dumps(result, allow_nan=False)