Require - Doctype's public accessible print pdf url

Hi,
I need to share public sharable url for my doctype (example: Sales Invoice pdf file with my Print Format). I could get some hashed url (https://somewebsitename.com/Sales%20Invoice/SINV-21-00342?format=My%20Custom%20Sales%20Invoice&key=e4ff0c02ba020a586aaca34b96756cc64ddcefbc42ac98560afb0673)in email notification but I want to achieve the same in SMS notification text that can be shared with my Customers or Users.

Right now, {{ doc.geturl() }} in my SMS Notification template is giving output something like this https://somewebsitename.com/app/Sales%20Invoice/SINV-21-00342 which has restricted access

Thanks in advance.
Regards,
Vinod Kumar K

That is what I use :

Exemple for delivery note

{{frappe.get_url()}}/delivery_note/{{doc.name}}?key={{frappe.get_doc(doc.doctype, doc.name).get_signature()}}

1 Like

Thanks Frederic. I ll give it a try

@VinodKumarkolli just give print permissions to Guest

Be careful with this. It is not a good solution in most situations, as guest users will be able to view all invoices from easily guessable URLs. @FredericVerville’s solution is much more secure.

@peterg not if you are good at coding and you can encrypt the name

I don’t follow you. These are URLs, derived from naming series. You can’t encrypt them if you want them to work.

Giving guests print permission is a bad practice.

1 Like

@peterg you can do anything you want if you are good enough at coding . in my case I encrypted the sales invoice name to something like “mlsdkfiekjsbnwbczidqsjocvpoxcqnaizdlqsdazeqlskjlazelkjakjqslqjd=” using python encrypt and changed the download pdf function to decrypt the code before generating pdf. this way you cant guess any other sales invoice name .

This is not a good practice or good advice.

2 Likes