Import invoice images/PDF

Hi there,

I am currently evaluating NextERP for us and started to import data, to see, if the functionality matches.

While importing of invoices, I am wondering, how it will be possible to upload and attach the images or PDFs of the digitalized documents to those invoices?

I wasn’t able to find anything related

Thanks alot for your help!



It might be possible to add a custom field pointing to the to the url of the pdf for each invoice. The choice of field type and how to batch the invoice pdfs to correspond to the ERPNext invoice series will be interesting.

Hi, thanks for your recommendation.

I am wondering, as it seems there is already basically a attachments field available at the invoices.

So as far as I understand, there is no need to add a custom field for it, or am I missing something?

A simple URL wouldn’t be enough, as it really should be uploaded there, to get the single source of truth into NextERP.

But how to import them? :smiley:

In v13 I am trying to find the Attachments on the Purchase Invoice form, is it only displayed when some other condition is met?

I think it appears after you persisted it… Did you do that?

I have submitted , yet it does not appear. v13.18

Strange, it seems I have the same version

Perhaps it’s a newer default when customizing the Purchase Invoice, which needs to be setup manually for users, which started on earlier versions ?

If you create a data import, and export a template, is there a field for attachments?

Unfortunately not, that’s neraly why I was creating this thread :wink:

Indeed I wasn’t really wondering, as files are not the best things to put into an csv.

So as the previously displayed “Attach File” field is nearly on any document here, I was hoping there is a kind of “upload ZIP with document-id references and attachments”, which dedicatedly enables the import of files to documents.

Some options that could be tried:

Manually attach the pdfs to each invoice.

Create a custom field , type Attachment and see if that will show up in the export template.

Create a Doctype with Invoice number and pdf, upload and link to Purchase Invoice.

How many Purchase Invoice are there to import?

Thanks for your options smino!

So the first option (to manually add) won’t happen, as there are over 10k invoices :wink:

I’ll try the 2nd in a few hours and give feedback on it

The third one sounds interesting… are there deeper docs for managing custom DocTypes available? But as interesting as the option seems, it would a bit surprise me, if the pdf can be uploaded to a different DocType, when an existing one cannot be modified to retrieve attachments (so it’s actually a bit similar to option 2, isnt it?) Am I missing something on my expectation?

The third option is similar to the second. Your tests will have to confirm whether it is possible or not. Is data from the original invoices being imported or are you only importing the pdfs. Or are the invoices the images of the invoices as received from vendors?

There are also meta data from the invoices available to import, like dates, ids, price, tax, partner and payment information etc.

It’s just a bit tricky to get them into, as it seems ERPNext requires related articles/items, which I am not having, so I have to “simulate” those articles with our previous cost centers - as far as I was researching yet

The import tool can export a template that can be used to match the old. Getting the old into a csv with the columns in the right order, as you know, is the biggest hurdle for you. Importing that many pdfs , however it is done, will require alot of disk space.

yes sure :slight_smile: - I am hoping there is a way to get the disk full with our pdf s and images :wink:

Ok @smino, I investigated as discussed with the following results:

When you add a custom file field to the DocType it will get available in upload/import
Unfortunately only one file each custom-field. So as there are sometimes more files for one single invoice, I’d need several custom fields then.

So far so good, the problem is, that I don’t see how the data can be transferred.
The file url is just a local path on the server… so perhaps, if I get a connection to the directory, I could upload all files, memoize the paths, and then upload it.
But I am a bit sceptic if this would work reliably.

I discovered the DocType File in the Core Module, which is kind of a missing link.
All of the attached/uploaded files are managed within this DocType and referered to other kinds of DocTypes or to the Attachment custom fields.
So with this in mind, I can reach my 1-5 attachments each invoice, without any custom field.

Unfortunately it’s the same thing regarding the upload of the binary data.
I have no idea how to import with a clean reference.

What do I mean with the last part of the sentence:
I can simply upload many files in the Files list. They’re then located on the servers harddrive… but they’re not getting any ID, which would help me to establish the connection to my Invoices in an import.

It may help to say the accounting software that you are trying to import from in case someone is familiar with it and has done a migration. Do the files on the server have any naming conventions or metadata fields that help identify them to the software?

Yes, we’re pretty free to organize the data as we need.

When I plan a migration like this, it usually consists of 2 steps:

1. Import the invoice data, for example with those columns (strongly reduced amount of cols, to get to the point):
Supplier | Article | … | Ext-ID

I am primarily focussing on Ext-ID (or some solutions also call it legacy_id)

2. Import the according file data:
Filename | DocType: PurchaseInvoice | missing: binary-data | Ext-ID of the already imported purchase

But that doesn’t seem to work this way, as also the filenames are moving on import.

So given the fact, I generate the attachment names like {invoiceid}-{attachment_nr}.pdf:

  • 12415-1.pdf
  • 12415-2.pdf
  • 12423-1.pdf
  • 12434-1.pdf

I’m not able to reference those names in the “assignment import” to map them to the invoices.

It could probably work, if I do 6 instead of 2 steps like:

  1. Import the invoice data with ext_id (I didnt find a matching one, so this needs to be a custom field).
  2. Upload all files with identifiable file_names
  3. Export the imported invoice data again to get the internal generated IDs to know the mapping to our legacy ext_ids
  4. Export the uploaded files to get the internal generated IDs associated with the names of the uploaded files
  5. Create the File Import based on the collected erpnext IDs
  6. Perform the final import to assign the invoices to the files.

If this will work finally, I have no idea… but it seems really extensive

I am wondering if no other people solved such a situation … I cannot imagine, that this is THE designed way…?

Thanks for your advise

1 Like

Hey there! You can’t do it directly. You’ll have to upload all images/pdf to Google drive. Make an excel of all the URLs ( you can Google it on how to do it). Paste those URLs to your attachment column in the data import template and upload.

It should work as it has worked for me