[FIX] ATTENDANCE: Attendance request work type and shift None value issue
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user