[FIX] ATTENDANCE: Attendance request work type and shift None value issue

This commit is contained in:
Horilla
2023-12-08 15:23:30 +05:30
parent fc2dd9f2a8
commit 71aaeeafdf
2 changed files with 4 additions and 4 deletions

View File

@@ -84,9 +84,9 @@ def get_diff_dict(first_dict, other_dict, model=None):
"%I:%M %p"
)
elif isinstance(field, models.ForeignKey):
if value is not None:
if value is not None and len(str(value)):
value = field.related_model.objects.get(id=value)
if other_value is not None:
if other_value is not None and len(str(other_value)):
other_value = field.related_model.objects.get(id=other_value)
difference[verb_key] = (value, other_value)
return difference

View File

@@ -323,8 +323,8 @@ class Attendance(models.Model):
"attendance_clock_in": str(self.attendance_clock_in),
"attendance_clock_out": str(self.attendance_clock_out),
"attendance_clock_out_date": str(self.attendance_clock_out_date),
"shift_id": self.shift_id.id,
"work_type_id": self.work_type_id.id,
"shift_id": self.shift_id.id if self.shift_id else "",
"work_type_id": self.work_type_id.id if self.work_type_id else "",
"attendance_worked_hour": self.attendance_worked_hour,
"minimum_hour": self.minimum_hour,
# Add other fields you want to store