From d65b57e6511be1efb427df4edcf273cf31a35533 Mon Sep 17 00:00:00 2001 From: Thomas Steen Rasmussen Date: Sun, 7 Apr 2019 17:28:56 +0200 Subject: [PATCH] set invoice_date and creditor for expenses for reimbursements --- src/backoffice/views.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/backoffice/views.py b/src/backoffice/views.py index 0ad7e8e3..1bcc82ed 100644 --- a/src/backoffice/views.py +++ b/src/backoffice/views.py @@ -395,10 +395,12 @@ class ReimbursementCreateView(CampViewMixin, EconomyTeamPermissionMixin, CreateV expense.responsible_team=economyteam expense.approved=True 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.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}))