personnes: worker attachement to holiday fix

This commit is contained in:
Serghei Mihai 2013-12-11 14:59:17 +01:00
parent 5b88932cb3
commit 4cf92e4aba
1 changed files with 2 additions and 0 deletions

View File

@ -408,6 +408,8 @@ class HolidayCreateView(HolidayManagement, cbv.CreateView):
try:
holiday = form.save()
worker = models.Worker.objects.get(pk = self.kwargs['worker_pk'])
holiday.worker = worker
holiday.save()
for service in worker.services.all():
holiday.services.add(service)
messages.success(self.request, u'Absence ajoutée avec succès')