Generate a fake payment link when previewing invoice
authorMagnus Hagander <magnus@hagander.net>
Tue, 12 Nov 2024 09:24:39 +0000 (10:24 +0100)
committerMagnus Hagander <magnus@hagander.net>
Tue, 12 Nov 2024 09:24:39 +0000 (10:24 +0100)
This way we get to see the qr code on the preview as well, even
though it can of course not be used. But it helps adjusting layouts.

postgresqleu/invoices/views.py

index 66d1c7719741fa81b5955fde59e022ca293cb668..5407d03d687c73e6caee9313ed8ef7a6d2ff2628 100644 (file)
@@ -340,6 +340,9 @@ def previewinvoice(request, invoicenum):
 
     invoice = get_object_or_404(Invoice, pk=invoicenum)
 
+    # Fake a secret so we get the QR code
+    invoice.recipient_secret = 'x' * 64
+
     # We assume there is no PDF yet
     wrapper = InvoiceWrapper(invoice)
     r = HttpResponse(content_type='application/pdf')