From 925f233e3fc6bdcbba91680c3cc825f625a1b891 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Delobelle?= Date: Tue, 30 Aug 2016 17:24:11 +0200 Subject: [PATCH] =?UTF-8?q?Cr=C3=A9ation=20d'un=20relev=C3=A9=20avec=20la?= =?UTF-8?q?=20balance=20initiale=20lors=20de=20la=20cr=C3=A9ation=20d'une?= =?UTF-8?q?=20caisse?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kfet/templates/kfet/checkout_read.html | 2 +- kfet/views.py | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/kfet/templates/kfet/checkout_read.html b/kfet/templates/kfet/checkout_read.html index 04134c03..14c9ddfd 100644 --- a/kfet/templates/kfet/checkout_read.html +++ b/kfet/templates/kfet/checkout_read.html @@ -20,7 +20,7 @@ {% if not statements %} Pas de relevé {% else %} - +
diff --git a/kfet/views.py b/kfet/views.py index f869509d..77fd2329 100644 --- a/kfet/views.py +++ b/kfet/views.py @@ -399,8 +399,19 @@ class CheckoutCreate(SuccessMessageMixin, CreateView): if not self.request.user.has_perm('kfet.add_checkout'): form.add_error(None, 'Permission refusée') return self.form_invalid(form) + # Creating form.instance.created_by = self.request.user.profile.account_kfet + checkout = form.save() + + # Création d'un relevé avec balance initiale + CheckoutStatement.objects.create( + checkout = checkout, + by = self.request.user.profile.account_kfet, + balance_old = checkout.balance, + balance_new = checkout.balance, + amount_taken = 0) + return super(CheckoutCreate, self).form_valid(form) # Checkout - Read