Data Import - Best practice for delete/rollback

Hi all

I’m testing the Import prcoedure in order to be ready to import in production all my items for the stock.

When I tried the first Import I had some mistake in the list of item so I decided to import again all the items form last import because that ones were completeley wrong. Under this scenario, what is the quick and clean way to clean the last imported rows (only that ones) and redo import .
When I try manually to delete them manually from the Frappe Gui I receive this type of error : “Cannot delete or cancel because Item XXXXX is linked with Stock Entry STE-NNNN”

how can I do a comfortable massive (think of thousands items) delete in case of rollback is needed after a unsuccessfull import operation?

Hello,

To unlink existing item, no alternative is available but to cancel the transactions.

In the existing items, if you want to change the Item Code, you can use the Bulk Renaming Tool.

https://frappe.github.io/erpnext/user/manual/en/setting-up/data/bulk-rename

If you want to correct value in the other fields of item, you can use Over-writing feature of Data Import Tool.

Hi Umair
Thanks for your answer very kind of you…
I tried to delete the items from GUI but I got “Cannot delete or cancel because Item XXXXX is linked with Stock Entry STE-NNNN” error.

Please what do you mean by “cancel the transaction?” may you clarify on this?
many thanks for your attention

Please check https://frappe.github.io/erpnext/user/manual/en/setting-up/articles/edit-submitted-document

Once you have submitted a transaction, you cannot delete it right away. You should cancel it first, and then delete.

1 Like

thanks for the tips. works great

I first canceled and deleted material request entry related to the item and then I was able to perform straight Deelete Item action from Document Panel.

May you tell me if there is a way to perform a bulk cancel from the Panel or I have to write python code that will do the cleaning according to this statements (from your link):

Note: If your document linked with other documents, then you will need to cancel last document you made on top of this document. Example:If you have created Delivery Note and Sales Invoice against Sales Order, which you need to amend, then you should first Cancel Delivery Note and Sales Invoice made for that Sales Order. Then amend Sales Order, re-save and re-submit it.