Supplier invoice import cannot import invoices, if an item appears on several lines

Hi all!

I have a strange problem importing supplier invoices.
When importing supplier invoices, if an item appears on several lines in the import file (but on different invoices), only the first invoice will be recorded with that item in ERPNext, the other invoices will not be stored.

Error description at the unstored lines: pymysql.err.IntegrityError: (1062, “Duplicate entry ‘item’ for key ‘PRIMARY’”).

Am I missing something?

Thanks for your help!


In case of multiple item lines, you need to leave series , supplier etc (header rows blank)

Hi Pawan!

Thank you for your reply.
I understand that concept, there is no problem with multiple lines of items in a single invoice.
I use your attached image as an example:

I marked two item lines in your image, that indicates what items causing the error in my case.
When I import invoices (let’s say your file) the first invoice with the “Services” and “Products” items is stored in ERPNext with no error. But the second invoice will not be stored, because the “Services” and “Products” item are appeared second time in the import Excel file.

What causing the problem in my case?

It should work, unless you share your file with data it would not be possible to find out why it is not working in your case.

Here is a link with the file:!AmNAemPwxMrqvJdi62BvhKtc9PPUvg?e=kFY64B

Items (and invoices) marked with green background successfully imported.
Invoices with red colored items are the problematic invoices.
As you see, an item’s first appearance is ok to import (green), the second (3rd, 4th, etc…) will not be imported (red).

You may have to leave “ID” column blank in case you are inserting new rows. You can also check the error log/message in your Data Import.

That was the problem, I successfully imported the invoices when I leave the item IDs blank.
Thank you for your help!