mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-12-23 07:23:46 +00:00
Fix bug send_mail + factorisation
This commit is contained in:
parent
175e2170eb
commit
42818cbe0b
3 changed files with 6 additions and 7 deletions
|
@ -50,7 +50,7 @@ from machines.models import regen
|
||||||
from re2o.field_permissions import FieldPermissionModelMixin
|
from re2o.field_permissions import FieldPermissionModelMixin
|
||||||
from re2o.mixins import AclMixin, RevMixin
|
from re2o.mixins import AclMixin, RevMixin
|
||||||
|
|
||||||
from cotisations.utils import find_payment_method
|
from cotisations.utils import send_mail_invoice, find_payment_method
|
||||||
from cotisations.validators import check_no_balance
|
from cotisations.validators import check_no_balance
|
||||||
|
|
||||||
|
|
||||||
|
@ -242,7 +242,10 @@ def facture_post_save(**kwargs):
|
||||||
Synchronise the LDAP user after an invoice has been saved.
|
Synchronise the LDAP user after an invoice has been saved.
|
||||||
"""
|
"""
|
||||||
facture = kwargs['instance']
|
facture = kwargs['instance']
|
||||||
|
is_created = kwargs['created']
|
||||||
user = facture.user
|
user = facture.user
|
||||||
|
if is_created:
|
||||||
|
send_mail_invoice(facture)
|
||||||
user.ldap_sync(base=False, access_refresh=True, mac_refresh=False)
|
user.ldap_sync(base=False, access_refresh=True, mac_refresh=False)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -89,7 +89,7 @@ def send_mail_invoice(invoice):
|
||||||
'Votre facture / Your invoice',
|
'Votre facture / Your invoice',
|
||||||
template.render(ctx),
|
template.render(ctx),
|
||||||
GeneralOption.get_cached_value('email_from'),
|
GeneralOption.get_cached_value('email_from'),
|
||||||
[invoice.user.email],
|
[invoice.user.get_mail],
|
||||||
attachments=[('invoice.pdf', pdf, 'application/pdf')]
|
attachments=[('invoice.pdf', pdf, 'application/pdf')]
|
||||||
)
|
)
|
||||||
mail.send()
|
mail.send()
|
||||||
|
|
|
@ -81,7 +81,7 @@ from .forms import (
|
||||||
)
|
)
|
||||||
from .tex import render_invoice
|
from .tex import render_invoice
|
||||||
from .payment_methods.forms import payment_method_factory
|
from .payment_methods.forms import payment_method_factory
|
||||||
from .utils import find_payment_method, send_mail_invoice
|
from .utils import find_payment_method
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
|
@ -148,8 +148,6 @@ def new_facture(request, user, userid):
|
||||||
p.facture = new_invoice_instance
|
p.facture = new_invoice_instance
|
||||||
p.save()
|
p.save()
|
||||||
|
|
||||||
send_mail_invoice(new_invoice_instance)
|
|
||||||
|
|
||||||
return new_invoice_instance.paiement.end_payment(
|
return new_invoice_instance.paiement.end_payment(
|
||||||
new_invoice_instance,
|
new_invoice_instance,
|
||||||
request
|
request
|
||||||
|
@ -848,8 +846,6 @@ def credit_solde(request, user, **_kwargs):
|
||||||
number=1
|
number=1
|
||||||
)
|
)
|
||||||
|
|
||||||
send_mail_invoice(invoice)
|
|
||||||
|
|
||||||
return invoice.paiement.end_payment(invoice, request)
|
return invoice.paiement.end_payment(invoice, request)
|
||||||
p = get_object_or_404(Paiement, is_balance=True)
|
p = get_object_or_404(Paiement, is_balance=True)
|
||||||
return form({
|
return form({
|
||||||
|
|
Loading…
Reference in a new issue