Resetting Naming Series?

Reference: fix(naming): Keep naming series number on document deletion to maintain integrity by Alchez · Pull Request #7635 · frappe/frappe · GitHub


Problem:

Currently in the system, whenever a document is created and then deleted, it resets the naming series to the previous numbering.

This can get problematic for a number of scenarios - say, for example, the system sends out a Sales Order document to a customer with a particular ID. In case this order is deleted, and a new one created for a different Customer, the new document will have the same name as the deleted document, which can lead to compliance issues.

Proposal:

By not unsetting the naming series whenever a document is deleted, and instead generate new names for each transaction / document, we avoid the issue entirely.

Arguments:

Rushabh mentioned “In many cases, the revert is required as legally you are not allowed to have “holes” in numbering series”.


I’m creating this post to get more views from the community, and come to a consensus on how to proceed with this issue.

Thanks!

1 Like

We faced the same problem in Sales Invoice.

Instead of deleting the Invoice, We first Submitted the Invoice and Cancelled It. In this way, you will have the record of the sales invoice and also the numbering doesn’t have holes.

2 Likes

Yeah, that is correct.

it will help to maintain uninterrupted series.

I think that this is a bad aproach, to simply “stops resetting the naming series”. I understand that this can be a problem for you and for many people, but, don’t you think that there are another group of people working fine with it as it is?
Maybe you should create a “configurable” solution. Maybe even a “per doctype” setting.

Integrity is the base of any good ERP System, In NO CASE two documents should ever have the same name.

Even in case you delete the document, copies of the document can be made before you delete it. Now the new document cannot have the same name because there will be an system integrity issue.

For all legal requirements, the laws that need numbering to not be broken always mean that there must be a ‘trail’. In all these cases the document should not be deleted.

Our current system as such wont save us from this; eg if you have doc 1 , 2 & 3 and you delete 2, the next doc created gets the number 4 (not 2)

Deleted documents must also leave audit trails, broken naming series is one such audit trail.

Can someone come up with a real use case where you don’t want the document to be stored as cancelled and have the naming series reset back ?