Try ERPNext Try Frappe Cloud Buy Support Partners Foundation

Generate PDF on submit of sales documents

Hi all, I just made this app that generates a PDF immediately when a document is submitted. At the moment it works for Quotation, Sales Order, Sales Invoice and Delivery Note.

The motivation is that I always want to know which PDF is the original that I sent to the customer while the print format might change over time.

Let me know what you think about it.

15 Likes

Hi @rmeyer
I like this function. Actually I see this as core function for ERPNext, because this is an easy and realiable way to save the status that went into the world (including data that was added in a print format which can be changed after submitting the doc itself).

Just testing it.

I see there is an option missing to freely set documents where this app works. It’s just a predefined list of 5 doctypes.

Do you still support this app or shall I do an independent fork and maintain by myself?

1 Like

Hi @Paul_Frydlewicz,

glad you like our app. Yes, we’re actively using and supporting it.

This app was built specifically for sales documents because we are legally required to persist them. The app automatically prints them in the customer’s language and puts them in a folder that is named like the customer. If we take away these features, it could apply to any DocType.

Please let me know if you would be willing to sponsor this feature and / or a contribution to the core. :slight_smile:

That sounds interesting.
Actually we’d need only PO as additional doctype.

Do you have a simple documentation on how/where the pdfs are stored?

Currently PDFs are stored in a {{ doctype }}/{{ customer }} folder hierarchy. For example, Sales Invoice/Customer Ltd/SINV-0001.pdf. So if you open the File List in ERPNext you should see a “Sales Invoice” folder, inside that a folder for each Customer, and inside that the Sales Invoice PDFs.

It should be doable to also add purchase documents and name the folders like the supplier.

Intresting. Also, An entry to tracking log along with link to pdf file will be helpful to know timeline comparison along with presenting quick navigation to pdf file.

You mean Activity Log, @jalajc?

@rmeyer
I mean, the version trail at the bottom if tracking is enabled. (entire list can be found at domain.name/desk#List/Version/List with docType as Sales Invoice)

@Paul_Frydlewicz I updated the app to work with any submittable DocType. Check out the version-13-beta or develop branch to try it (won’t make it to version-12).

3 Likes

Great addition.

@rmeyer, that’s genious.
Thanks a lot.
I installed in on the production server for our new customer and testing it, looks good so far.

I didn’t use v13 yet. Do you recommend to run a production server on the newest v13 beta?

V13 beta is pretty usable already, but still you must expect a lot of changes and errors. I would recommend to only use the stable version in production.

I have a question regarding permissions with submitted pdfs.

Once a pdf is attached, the Read permissions are virtually set for every system user, isn’t it. As from my experience, I cannot limit read access to files attached based on user roles.

Please correct me if I’m wrong…

File is just a reguler doctype. You can restrict it just like sale orders, invoices etc.

yes right, but in this case, the permissions should not depend on the doctype “File”, but the doctype which the pdf represents, e.g. Sales Invoice or Quotation.

I see here a basic lack of permission control on ERPNext side, which is essenial.
Do I miss something?

For this use case it would be nice to have an option to choose either

  • Role based permission management for a particular document based on its doctype (default)
  • inherit permissions from another document (e.g. document where a file is attached to)

Does this app work in version 12?

Yes, but only for sales documents.

1 Like

New to how to include this, but going to test this. Looks promising. I was working around in python to achieve this in a different way, but your solution makes more sense. Thanks.

Can you define where it stores, e.g. NFS mount?

The app uses the builtin attachment feature of Frappe / ERPNext. So all files are stored on the server in ~/frappe-bench/sites/[YOUR SITE]/private/files. Maybe you can mount some other file system at this location?

1 Like