Esempio n. 1
0
def invoice_download(request, pk):
    """https://github.com/johnsensible/django-sendfile"""
    invoice = get_object_or_404(Invoice, pk=pk)
    check_perm(request.user, invoice.contact)
    return sendfile(request,
                    invoice.pdf.path,
                    attachment=True,
                    attachment_filename='{}.pdf'.format(
                        invoice.invoice_number))
Esempio n. 2
0
def invoice_download(request, pk):
    """https://github.com/johnsensible/django-sendfile"""
    invoice = get_object_or_404(Invoice, pk=pk)
    check_perm(request.user, invoice.contact)
    return sendfile(
        request,
        invoice.pdf.path,
        attachment=True,
        attachment_filename='{}.pdf'.format(invoice.invoice_number)
    )
Esempio n. 3
0
def report_invoice_time_analysis_csv(request, pk):
    invoice = get_object_or_404(Invoice, pk=pk)
    check_perm(request.user, invoice.contact)
    response = HttpResponse(content_type='text/csv')
    file_name = 'invoice_{}_time_analysis.csv'.format(invoice.pk)
    response['Content-Disposition'] = 'attachment; filename="{}"'.format(
        file_name)
    report = ReportInvoiceTimeAnalysisCSV()
    report.report(invoice, request.user, response)
    return response
Esempio n. 4
0
def report_invoice_time_analysis_csv(request, pk):
    invoice = get_object_or_404(Invoice, pk=pk)
    check_perm(request.user, invoice.contact)
    response = HttpResponse(content_type='text/csv')
    file_name = 'invoice_{}_time_analysis.csv'.format(invoice.pk)
    response['Content-Disposition'] = 'attachment; filename="{}"'.format(
        file_name
    )
    report = ReportInvoiceTimeAnalysisCSV()
    report.report(invoice, request.user, response)
    return response