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