forked from DGNum/gestioCOF
Création d'un relevé avec la balance initiale lors de la création d'une
caisse
This commit is contained in:
parent
fefa6ca5e2
commit
925f233e3f
2 changed files with 12 additions and 1 deletions
|
@ -20,7 +20,7 @@
|
||||||
{% if not statements %}
|
{% if not statements %}
|
||||||
Pas de relevé
|
Pas de relevé
|
||||||
{% else %}
|
{% else %}
|
||||||
<table class="table table-bordered">
|
<table class="table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<td></td>
|
<td></td>
|
||||||
|
|
|
@ -399,8 +399,19 @@ class CheckoutCreate(SuccessMessageMixin, CreateView):
|
||||||
if not self.request.user.has_perm('kfet.add_checkout'):
|
if not self.request.user.has_perm('kfet.add_checkout'):
|
||||||
form.add_error(None, 'Permission refusée')
|
form.add_error(None, 'Permission refusée')
|
||||||
return self.form_invalid(form)
|
return self.form_invalid(form)
|
||||||
|
|
||||||
# Creating
|
# Creating
|
||||||
form.instance.created_by = self.request.user.profile.account_kfet
|
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)
|
return super(CheckoutCreate, self).form_valid(form)
|
||||||
|
|
||||||
# Checkout - Read
|
# Checkout - Read
|
||||||
|
|
Loading…
Reference in a new issue