Delete all transactions of a company ​

After you test ERPNext with sample transactions, you can delete all transactions of the company and keep its setup and masters. You can then start live work without creating the masters again.

WARNING

Deleted transactions cannot be restored, except from a backup. Take a backup and check that you can restore it before you start.

What is deleted and what is kept ​

DeletedKept
The transactions of the company, such as Sales Invoices, Sales Orders, Payment Entries, Journal Entries, Stock Entries, and Work Orders.The company itself and its setup.
For documents that have no company field and are in the delete list: all their records, for all companies.Masters such as Customer, Supplier, Item, Account, Warehouse, Cost Center, Territory, Customer Group, Supplier Group, and Item Group.

The exact list depends on the modules and documents on your site. Review it before you delete.

Prerequisites ​

  • The System Manager role, and the Write and Delete permissions on the company.
  • A full backup.
  • If the company was used for live accounting, export the ledgers and reports that you must keep.
  • Nobody creates transactions for the company while the deletion runs.

Delete from the Company form ​

  1. Open the Company list and open the company. Check the name carefully.
  2. Select Manage > Delete Transactions.
  3. Enter your password.
  4. Enter the company name to confirm, and select Delete.

ERPNext creates and submits a Transaction Deletion Record, and deletes the transactions in the background. Do not close the site or create transactions for the company until it is complete.

Review the list before you delete ​

To see and change the list of documents to delete first, use a Transaction Deletion Record directly.

  1. Open the Transaction Deletion Record list and select Add Transaction Deletion Record.
  2. Select the Company.
  3. Save, and select Generate To Delete List. DocTypes To Delete shows each document type and its number of documents.
  4. Optional: select Remove Zero Counts to remove empty rows. Add document types to Excluded DocTypes to keep them.
  5. Optional: use Template > Export and Template > Import to edit the list as a CSV file.
  6. Select Submit, read the warning, and confirm.

The Status changes from Queued to Running and then Completed. The Summary table shows how many documents of each type were deleted. If the status is Failed, check the Error Log and select Retry.

After the deletion ​

  • Open the main transaction lists, such as Sales Invoice, Purchase Invoice, Payment Entry, Journal Entry, Stock Entry, and Sales Order, and check that the company's documents are gone.
  • Check the accounting and stock reports of the company.
  • Before new work, check the masters, the opening balances, the stock balances, and the fiscal year.

When not to use it ​

  • As routine cleanup of a live company.
  • To reverse a few transactions. Cancel them instead. See About submit, cancel, and amend.
  • When you need the audit trail of the transactions on the same site.

Troubleshooting ​

ProblemFix
Transactions are still visibleThey belong to another company, or they are masters.
Balances are not zeroCheck for opening balances or stock balances that were entered separately, and the linked transactions.
Permission errorAsk a System Manager to run the deletion.
The wrong company was deletedStop work on the site, and restore the backup.

TIP

Restore a recent backup on a test site and run the deletion there first. Check the result, then repeat on the main site.