Browse Source

[FIX] b_shift : attendance sheet generation

When several same shifts exists
pull/125/head
Elouan Le Bars 5 years ago
parent
commit
0826520255
  1. 9
      beesdoo_shift/models/attendance_sheet.py

9
beesdoo_shift/models/attendance_sheet.py

@ -422,9 +422,13 @@ class AttendanceSheet(models.Model):
("end_time", "<", to_string(e_time + delta)),
]
)
workers = []
for task in tasks:
if task.worker_id and (task.state != "cancel"):
new_expected_shift = expected_shift.create(
# Only one shift is added if multiple similar exist
if task.worker_id and task.worker_id not in workers and (task.state != "cancel") :
expected_shift.create(
{
"attendance_sheet_id": new_sheet.id,
"task_id": task.id,
@ -436,6 +440,7 @@ class AttendanceSheet(models.Model):
"is_compensation": task.is_compensation,
}
)
workers.append(task.worker_id)
# Maximum number of workers calculation (count empty shifts)
new_sheet.max_worker_no = len(tasks)
return new_sheet

Loading…
Cancel
Save