|
|
@ -141,9 +141,14 @@ def new_facture(request, user, userid): |
|
|
'users:profil', |
|
|
'users:profil', |
|
|
kwargs={'userid': userid} |
|
|
kwargs={'userid': userid} |
|
|
)) |
|
|
)) |
|
|
|
|
|
is_online_payment = new_invoice_instance.paiement == ( |
|
|
|
|
|
Paiement.objects.get_or_create( |
|
|
|
|
|
moyen='Rechargement en ligne')[0]) |
|
|
|
|
|
new_invoice_instance.valid = is_online_payment |
|
|
# Saving the invoice |
|
|
# Saving the invoice |
|
|
new_invoice_instance.save() |
|
|
new_invoice_instance.save() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Building a purchase for each article sold |
|
|
# Building a purchase for each article sold |
|
|
for art_item in articles: |
|
|
for art_item in articles: |
|
|
if art_item.cleaned_data: |
|
|
if art_item.cleaned_data: |
|
|
@ -159,6 +164,12 @@ def new_facture(request, user, userid): |
|
|
) |
|
|
) |
|
|
new_purchase.save() |
|
|
new_purchase.save() |
|
|
|
|
|
|
|
|
|
|
|
if is_online_payment: |
|
|
|
|
|
content = online_payment.PAYMENT_SYSTEM[ |
|
|
|
|
|
AssoOption.get_cached_value('payment') |
|
|
|
|
|
](invoice, request) |
|
|
|
|
|
return render(request, 'cotisations/payment.html', content) |
|
|
|
|
|
|
|
|
# In case a cotisation was bought, inform the user, the |
|
|
# In case a cotisation was bought, inform the user, the |
|
|
# cotisation time has been extended too |
|
|
# cotisation time has been extended too |
|
|
if any(art_item.cleaned_data['article'].type_cotisation |
|
|
if any(art_item.cleaned_data['article'].type_cotisation |
|
|
|