moshthepitt/small-small-hr

Add view to add annual leave in bulk

moshthepitt opened this issue · 2 comments

  • Check all active staff members that do not have leave days
  • Generate llist of the users with with formsets for the annual leave records of each user
  • Create the records when saved

Optionally add a flag to notify admin that there are users with no annual leave records

l = Leave.SICK
d = 10
y = 2019
for item in StaffProfile.objects.exclude(annualleave__leave_type=l, annualleave__year=y):
    annual_leave = AnnualLeave(year=y, staff=item, allowed_days=d, leave_type=l)
    annual_leave.save()

l = Leave.REGULAR
d = 10
y = 2019
for item in StaffProfile.objects.exclude(annualleave__leave_type=l, annualleave__year=y):
    annual_leave = AnnualLeave(year=y, staff=item, allowed_days=d, leave_type=l)
    annual_leave.save()