From ecdc62df7ca20e28eacfe7f0ffd400022211eebc Mon Sep 17 00:00:00 2001 From: Benjamin Bach Date: Tue, 12 Dec 2017 22:16:06 +0100 Subject: [PATCH] Add IBAN/SWIFT to custom invoices, bank name in settings - fixes #172 (#187) --- src/bornhack/environment_settings.py.dist | 1 + src/shop/invoiceworker.py | 6 ++++++ src/shop/templates/pdf/custominvoice.html | 9 ++++++++- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/bornhack/environment_settings.py.dist b/src/bornhack/environment_settings.py.dist index ba64d51c..6dd63947 100644 --- a/src/bornhack/environment_settings.py.dist +++ b/src/bornhack/environment_settings.py.dist @@ -61,6 +61,7 @@ COINIFY_CALLBACK_HOSTNAME='{{ coinify_callback_hostname | default('') }}' # leav # shop settings PDF_LETTERHEAD_FILENAME='{{ pdf_letterhead_filename }}' +BANKACCOUNT_BANK='{{ bank_name }}' BANKACCOUNT_IBAN='{{ iban }}' BANKACCOUNT_SWIFTBIC='{{ swiftbic }}' BANKACCOUNT_REG='{{ regno }}' diff --git a/src/shop/invoiceworker.py b/src/shop/invoiceworker.py index cecd51e3..e3d210bb 100644 --- a/src/shop/invoiceworker.py +++ b/src/shop/invoiceworker.py @@ -1,3 +1,4 @@ +from django.conf import settings from django.core.files import File from utils.pdf import generate_pdf_letter from shop.email import add_invoice_email, add_creditnote_email @@ -39,6 +40,11 @@ def do_work(): template=template, formatdict={ 'invoice': invoice, + 'bank': settings.BANKACCOUNT_BANK, + 'bank_iban': settings.BANKACCOUNT_IBAN, + 'bank_bic': settings.BANKACCOUNT_SWIFTBIC, + 'bank_dk_reg': settings.BANKACCOUNT_REG, + 'bank_dk_accno': settings.BANKACCOUNT_ACCOUNT, }, ) logger.info('Generated pdf for invoice %s' % invoice) diff --git a/src/shop/templates/pdf/custominvoice.html b/src/shop/templates/pdf/custominvoice.html index f204a16a..2d162011 100644 --- a/src/shop/templates/pdf/custominvoice.html +++ b/src/shop/templates/pdf/custominvoice.html @@ -51,5 +51,12 @@

-Payment should be made by bank transfer to our account in Arbejdernes Landsbank reg. 5371 account no. 0244504 within two weeks from {{ invoice.created|date:"b jS, Y" }} please. Thank you! + Payment should be made by bank transfer to our account in {{ bank }}:

+