Invoice generation

1,207 views
Skip to first unread message

Marie-Claire ORDOQUY

unread,
Jan 30, 2014, 4:07:08 AM1/30/14
to django...@googlegroups.com
Hi,

I’m testing django-oscar, and I saw a billing address but no invoice.
I saw a message from last year where you explain there is no invoice generation in Oscar.

In djangopackages.com/grids/g/ecommerce/ I saw that ‘pdf invoice generation is possible but not in core’. 
Is there an existing extension to generate invoice ?

Regards,

Marie-Claire ORDOQUY


PS : sorry for the english, I’m french…

Izidor Matušov

unread,
Jan 30, 2014, 4:54:19 AM1/30/14
to django...@googlegroups.com
Hi Marie-Claire,

On 30/01/14 09:07, Marie-Claire ORDOQUY wrote:
> I saw that ‘pdf invoice
> generation is possible but not in core’.
> Is there an existing extension to generate invoice ?

I don't know about a project using Oscar that generates PDF invoices.
However, it is easily doable:

1, Oscar already has couple views that looks like an invoice (e.g.
dashboard page for an order)

2, You can create your custom view based on that order view.

3, Use pisa to convert your HTML to PDF:
http://agiliq.com/blog/2008/10/generating-pdfs-with-django/

Alternatively, you might use another library that generates PDFs:

https://docs.djangoproject.com/en/dev/howto/outputting-pdf/

Izidor

mcor...@gmail.com

unread,
Jan 30, 2014, 5:28:19 AM1/30/14
to django...@googlegroups.com
Thanks Izidor.
Then I'll create a custom view and use relatorio for the pdf generation.

Sebastian Vetter

unread,
Jan 30, 2014, 6:20:54 PM1/30/14
to django...@googlegroups.com
Hi Marie-Claire,

we've actually done something similar in one of your projects before. We used pisa as
Izidor suggested and hooked it up to the OrderListView in the dashboard. I've put the
relevant sections into a gist: https://gist.github.com/elbaschid/8722203

It was a bit tricky to get the HTML formatting right so that the PDF would would overflow
correctly onto multiple pages with many lines in a single order. I've you'd be insterested in
the HTML and pisa-specific CSS for the formatting let me know and I'll see that I can extract
the useful bits from that as well.

Cheers,
Seb

mcor...@gmail.com

unread,
Jan 31, 2014, 3:31:13 AM1/31/14
to django...@googlegroups.com
Thanks Sebastian, it is very nice.
But it is easier for me to use an OpenOffice template with relatorio to generate the pdf.


Le jeudi 30 janvier 2014 10:07:08 UTC+1, Marie-Claire ORDOQUY a écrit :

Valery Sorokin

unread,
Jan 31, 2014, 3:43:28 AM1/31/14
to django...@googlegroups.com

Hi Sebastian,
It'd be nice to see how was solved formating problems for multipage invoices.

Cheers,
Valery

--
https://github.com/tangentlabs/django-oscar
http://django-oscar.readthedocs.org/en/latest/
https://twitter.com/django_oscar
---
You received this message because you are subscribed to the Google Groups "django-oscar" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-oscar...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-oscar.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-oscar/893ee374-dc47-4c99-b5a0-d23ce55017c4%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Jochen Wagner

unread,
Feb 2, 2014, 8:28:30 AM2/2/14
to django...@googlegroups.com
Hi,

I'm using xhtml2pdf
https://github.com/chrisglass/xhtml2pdf/blob/master/doc/usage.rst

Works great. You can define headers, footers and so on.
A pagebreak is done with a simple "<div><pdf:nextpage /></div>"

When you try the examples, omit the comments, they are causing errors.

Jochen


Sebastian Vetter

unread,
Feb 2, 2014, 7:02:23 PM2/2/14
to django...@googlegroups.com
Hi Valery,

I've created a gist containing the base template we use for the invoice and the
derived template that just filles in the content. The formatting of the page is in the
base.html and the splitting across multiple pages in order_packing_slip.html.

It's not the most sophisticated solution but I remember we experimented with
alternatives that all turned out to be less useful.

@Jochen: the tricky bit is to work out when to actually include the line break,
especially when you have lines/line items with long names or other details that
wrap onto multiple lines in a single table cell. Then it becomes more and more
difficult to work out when to break the page or not.

I'm not saying this is the best solution, but hopefully it saves some time for anyone
having to deal with a similar situation :)

Cheers,
Seb

Sebastian Vetter

unread,
Feb 2, 2014, 7:03:01 PM2/2/14
to django...@googlegroups.com
Argh, forgot the link:

    https://gist.github.com/elbaschid/8776935

Sorry about that,
Seb

Jochen Wagner

unread,
Feb 5, 2014, 4:42:30 AM2/5/14
to django...@googlegroups.com
Thank you! That's really useful for future reference.
Jochen

Asi Li

unread,
Mar 10, 2015, 10:11:36 AM3/10/15
to django...@googlegroups.com
I would like to use the source code in that gist.
can anyone confirm the code works as expected?

It would be nice to see an output example before I implement it in my project.

10x

Asi Li

unread,
Mar 11, 2015, 12:24:51 PM3/11/15
to django...@googlegroups.com
The gist code works well.
Does anyone has a nice looking order invoice template that he can share?

Thanks!

Asi Li

unread,
Mar 17, 2015, 3:19:21 PM3/17/15
to django...@googlegroups.com
second try...
This would be much appreciated.

YusufSalahAdDin

unread,
Sep 6, 2016, 11:41:20 PM9/6/16
to django-oscar
Did anyone a fix for this problem?
Reply all
Reply to author
Forward
0 new messages