set invoice_date and creditor for expenses for reimbursements

This commit is contained in:
Thomas Steen Rasmussen 2019-04-07 17:28:56 +02:00
parent a989579f1e
commit d65b57e651

View file

@ -395,10 +395,12 @@ class ReimbursementCreateView(CampViewMixin, EconomyTeamPermissionMixin, CreateV
expense.responsible_team=economyteam expense.responsible_team=economyteam
expense.approved=True expense.approved=True
expense.reimbursement=reimbursement expense.reimbursement=reimbursement
expense.invoice_date=timezone.now()
expense.creditor=Credebtor.objects.get(name='Reimbursement')
expense.invoice.save("na.jpg", File(open(os.path.join(settings.DJANGO_BASE_PATH, "static_src/img/na.jpg"), "rb"))) expense.invoice.save("na.jpg", File(open(os.path.join(settings.DJANGO_BASE_PATH, "static_src/img/na.jpg"), "rb")))
expense.save() expense.save()
messages.success(self.request, "Reimbursement %s has been created" % reimbursement.pk) messages.success(self.request, "Reimbursement %s has been created with invoice_date %s" % (reimbursement.pk, timezone.now()))
return redirect(reverse('backoffice:reimbursement_detail', kwargs={'camp_slug': self.camp.slug, 'pk': reimbursement.pk})) return redirect(reverse('backoffice:reimbursement_detail', kwargs={'camp_slug': self.camp.slug, 'pk': reimbursement.pk}))