django-oscar icon indicating copy to clipboard operation
django-oscar copied to clipboard

Order PDFs

Open jayvdb opened this issue 4 years ago • 7 comments

A few oscar sites here on GitHub, and likely even more not on GitHub, have Order PDF generation.

It seems like it should be a part of the orders app, or an installable app maintained by @django-oscar org.

GitHub implementations:

  • https://github.com/embedded1/django-package-forwarding/blob/8c3286e9a7da8f4ae0401a81c8037585b3bb7ba6/apps/dashboard/orders/views.py (reportlab)
  • https://github.com/dbca-wa/ledger/blob/249367358f12c2f8b5b4cda690deec3fee24ecd2/ledger/payments/views.py and https://github.com/dbca-wa/disturbance/blob/2824561b504dc9841e397d915463d4540f245abb/disturbance/components/das_payments/views.py and others in the same org (reportlab)
  • https://github.com/UnruledLab/MebelJazz/search?q=pdf (pdfkit)
  • https://github.com/sladinji/blousebrothers/blob/461de3ba011c0aaed3f0014136c4497b6890d086/blousebrothers/dashboard/orders/views.py (django_weasyprint)
  • https://github.com/leonardo-modules/leonardo-store/blob/8779600542e20197628d1ff8feb2d230c1c7c698/leonardo_store/payments/invoice/views.py (xhtml2pdf)

jayvdb avatar Feb 07 '21 13:02 jayvdb

If you ask me, I would implement django-weasyprint out of the box. It is simple, efficient and with a free and permissive license for commercial projects. Reportlab is probably more powerful and/or versatile, but I don't think it contributes more to this task than django-weasyprint.

As django-weasyprint already comes with a CBV and a Mixin the integration should be trivial.

meigallodixital avatar Feb 10 '21 11:02 meigallodixital

ping @sladinji , perhaps you'd like to contribute your PDF implementation?

jayvdb avatar Feb 10 '21 19:02 jayvdb

I feel like https://github.com/django-oscar/django-oscar-invoices might already be addressing this use case - and if it isn't then extending it to do so might be a good approach.

solarissmoke avatar Feb 11 '21 04:02 solarissmoke

Ping @samitnuk and @sasha0 .

For starters, I've created https://github.com/django-oscar/django-oscar-invoices/pull/30 so it is able to be used with modern Django+Oscar environments.

jayvdb avatar Feb 11 '21 07:02 jayvdb

Pong.

Thanks, we'll review soon.

sasha0 avatar Feb 11 '21 07:02 sasha0

I feel like https://github.com/django-oscar/django-oscar-invoices might already be addressing this use case - and if it isn't then extending it to do so might be a good approach.

Our intention here is that. Use oscar-invoices and extend it with weasyprint. But now we are too busy to make it an installable plugin :\

meigallodixital avatar Feb 11 '21 08:02 meigallodixital

I'll be glad you use it ! I did it some years ago but I don't think there's any update to do.

As you can see on the link you provided ( https://github.com/sladinji/blousebrothers/blob/461de3ba011c0aaed3f0014136c4497b6890d086/blousebrothers/dashboard/orders/views.py ) you can share the same template between html and pdf rendering.html. And the only skills required to custom pdf invoices are html and css coding.

Unfortunately, I won't be able to contribute more than that those days...

On Wed, Feb 10, 2021 at 8:19 PM John Vandenberg [email protected] wrote:

ping @sladinji https://github.com/sladinji , perhaps you'd like to contribute your PDF implementation?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/django-oscar/django-oscar/issues/3639#issuecomment-776953435, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB7KR72EVNQDOWA6PHHFHXTS6LL45ANCNFSM4XHPBPPA .

sladinji avatar Feb 11 '21 08:02 sladinji

As pointed out, we have https://github.com/django-oscar/django-oscar-invoices/ which looks like it addresses the use case. So I'm closing this issue for now.

joeyjurjens avatar Jun 23 '23 14:06 joeyjurjens