From 4eb912e8e0b1d5973663ef925b69f0bc27242739 Mon Sep 17 00:00:00 2001 From: Serghei MIHAI Date: Wed, 22 Oct 2014 01:34:40 +0200 Subject: [PATCH] fixing invoice emailing templates Closes #5760 --- .../data/management/commands/email_new_invoices.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/synchro_orleans/data/management/commands/email_new_invoices.py b/synchro_orleans/data/management/commands/email_new_invoices.py index b811a36..8465bda 100644 --- a/synchro_orleans/data/management/commands/email_new_invoices.py +++ b/synchro_orleans/data/management/commands/email_new_invoices.py @@ -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()