parent
00d2eff709
commit
4eb912e8e0
|
@ -32,7 +32,6 @@ class Command(BaseCommand):
|
|||
"""
|
||||
|
||||
email_subject = 'Votre facture est disponible sur le portail citoyen'
|
||||
email_template = 'invoice_mail.txt'
|
||||
email_from = settings.DEFAULT_FROM_EMAIL
|
||||
secret = settings.INVOICE_HASHING_SECRET
|
||||
|
||||
|
@ -75,13 +74,15 @@ class Command(BaseCommand):
|
|||
context = Context(context)
|
||||
|
||||
if invoice.prelevement_automatique:
|
||||
self.email_template = 'autobilling_invoice_mail.txt'
|
||||
email_template = 'autobilling_invoice_mail.txt'
|
||||
elif invoice.solde == 0:
|
||||
self.email_template = 'null_invoice_mail.txt'
|
||||
email_template = 'null_invoice_mail.txt'
|
||||
elif invoice.solde < 1:
|
||||
self.email_template = 'sub1_invoice_mail.txt'
|
||||
email_template = 'sub1_invoice_mail.txt'
|
||||
else:
|
||||
email_template = 'invoice_mail.txt'
|
||||
|
||||
text_body = get_template(self.email_template).render(context)
|
||||
text_body = get_template(email_template).render(context)
|
||||
message = EmailMultiAlternatives(self.email_subject, text_body, self.email_from, [data['email']])
|
||||
message.attach_file(os.path.join(settings.INVOICES_DIR, 'facture_%s.pdf'% invoice.id))
|
||||
message.send()
|
||||
|
|
Reference in New Issue