Erasing old data

In order to keep my ErpNext system fast, I would like to erase all the transactions that are older than 5 years: Sales orders, delivery notes, invoices, purchase orders, related customers. I do not need to be able to recover this data.
Is this possible? I am using ErpNext on the Frappe cloud.

@jpkuhn you have many options. you can do it manually , just filter the date and delete everything. if you have acces to the bench , you can use frappe.db.delete .
if you want something more cooler and you are good at coding . you can create a scheduler event that delete everything older that 5 years, this way you will always have data less than 5 years old. you can also create a ui to control these events . this is actually great idea you have.

@jpkuhn you should consider the impact of these on your company’s historical balances, because older transactions add up to the current balances you carry in the books.

Don’t try it.A bundle of confusion that you can’t manage.Everything about your accounts will be inaccurate.

1 Like

In fact, I don’t use the accounting part in ErpNext. It is done externally.
Also, I think it should be possible. Otherwise all instances of ErpNext are doomed to get bigger and bigger as time goes on.

I think it’s okay to do it , accounting and balances can be grouped by year .

Like SAP, ERPNext should have an archive mechanism. Any data more than x days gets archived. Or user manually archives it. It’s true that db gets bloated with historical data leading to performance issues.


Here’s another, similar discussion from last year:
High storage consumption in ERPNext, is this normal?

From my perspective, here are the challenges with any hypothetical “Archive Tool”:

  • One person’s "junk data" = Another person’s “very-valuable data

  • Ask 100 ERPNext forum users for Archive criteria and rules? You will get 100 different answers.

  • It is extremely easy to break Frappe/ERPNext by accidentally deleting the wrong tables/rows. Likewise, you can also break it by not deleting too-few related rows.

  • Assume ERPNext had such an Archive Tool. Some people would make mistakes. Some of those mistakes would lead to data loss. And some of the data loss would lead to angry blame, and potentially legal actions.

I personally believe (with no evidence to support my belief) that the reasons above are why no Archive Tool has been developed yet.

  • One person’s " junk data" = Another person’s “ very-valuable data
  • Ask 100 ERPNext forum users for Archive criteria and rules? You will get 100 different answers.

@brian_pond Agree on this and that is why this should be rule based where users can create the rules.

May be what we are looking for is a sophisticated delete company transactions.