From c6d4c1edc3187f33f70a04185bc0060c495a6c23 Mon Sep 17 00:00:00 2001 From: Thomas Steen Rasmussen Date: Sat, 18 Jun 2016 20:51:53 +0200 Subject: [PATCH] commit creditnote stuff --- shop/admin.py | 3 +- shop/email.py | 22 ++++++++++ shop/management/commands/invoice-worker.py | 47 +++++++++++++++++++-- shop/models.py | 46 +++++++++++++++++--- shop/templates/emails/creditnote_email.html | 12 ++++++ shop/templates/emails/creditnote_email.txt | 14 ++++++ shop/templates/pdf/creditnote.html | 44 +++++++++++++++++++ 7 files changed, 177 insertions(+), 11 deletions(-) create mode 100644 shop/templates/emails/creditnote_email.html create mode 100644 shop/templates/emails/creditnote_email.txt create mode 100644 shop/templates/pdf/creditnote.html diff --git a/shop/admin.py b/shop/admin.py index 5cdc3c50..65cff8bf 100644 --- a/shop/admin.py +++ b/shop/admin.py @@ -7,6 +7,7 @@ admin.site.register(models.EpayPayment) admin.site.register(models.CoinifyAPIInvoice) admin.site.register(models.CoinifyAPICallback) admin.site.register(models.Invoice) +admin.site.register(models.CreditNote) @admin.register(models.ProductCategory) @@ -55,12 +56,12 @@ class OrderAdmin(admin.ModelAdmin): ] list_filter = [ - 'user', 'camp', 'payment_method', 'open', 'paid', 'cancelled', + 'user', ] exclude = ['products'] diff --git a/shop/email.py b/shop/email.py index 38f5094b..9072c84c 100644 --- a/shop/email.py +++ b/shop/email.py @@ -11,6 +11,10 @@ def send_email(emailtype, recipient, formatdict, subject, sender='BornHack +
+This email contains your creditnote from BornHack.
+The creditnote number is {{ creditnote.pk }}.
+
+The creditnote is attached in PDF format with the filename {{ creditnote.filename }}. The PDF contains the details about what this creditnote covers.
+
+
+Best regards,
+
+The BornHack Team
+
\ No newline at end of file diff --git a/shop/templates/emails/creditnote_email.txt b/shop/templates/emails/creditnote_email.txt new file mode 100644 index 00000000..27d6fbca --- /dev/null +++ b/shop/templates/emails/creditnote_email.txt @@ -0,0 +1,14 @@ +Hello! + +This email contains your creditnote from BornHack. +The creditnote number is {{ creditnote.pk }}. + +The creditnote is attached in PDF format with +the filename {{ creditnote.filename }}. The PDF +contains the details about what this creditnote +covers. + + +Best regards, + +The BornHack Team diff --git a/shop/templates/pdf/creditnote.html b/shop/templates/pdf/creditnote.html new file mode 100644 index 00000000..fc2e8686 --- /dev/null +++ b/shop/templates/pdf/creditnote.html @@ -0,0 +1,44 @@ +{% load static from staticfiles %} +{% load shop_tags %} + + + + + + + +
  +

+ {{ creditnote.created|date:"b jS, Y" }}
+ Creditnote #{{ invoice.pk }} +

+
+

Customer: {{ creditnote.order.user.email }}

+
+

CREDITNOTE

+ + + + + +
+ Text + + Amount +
+ {{ creditnote.text }} + + {{ creditnote.amount|currency }} + +
+ + Danish VAT (25%) + + {{ creditnote.vat|currency }} + +
+ + Total + + {{ creditnote.amount|currency }} +