diff --git a/cotisations/utils.py b/cotisations/utils.py index b1e5f613..6746a1da 100644 --- a/cotisations/utils.py +++ b/cotisations/utils.py @@ -99,7 +99,7 @@ def send_mail_invoice(invoice): def send_mail_voucher(invoice): """Creates a voucher from an invoice and sends it by email to the client""" - president = Mandate.get_mandate().president + president = Mandate.get_mandate(invoice.date).president ctx = { 'asso_name': AssoOption.get_cached_value('name'), 'pres_name': ' '.join([president.name, president.surname]), diff --git a/cotisations/views.py b/cotisations/views.py index a32c320f..437d5df1 100644 --- a/cotisations/views.py +++ b/cotisations/views.py @@ -1068,7 +1068,7 @@ def voucher_pdf(request, invoice, **_kwargs): _("Could not find a voucher for that invoice.") ) return redirect(reverse('cotisations:index')) - president = Mandate.get_mandate().president + president = Mandate.get_mandate(invoice.date).president return render_voucher(request, { 'asso_name': AssoOption.get_cached_value('name'), 'pres_name': ' '.join([president.name, president.surname]),