Set up naming series ​

A naming series is a pattern for document IDs. It has a prefix and a number. For example, the series SINV-.YYYY.-.##### gives Sales Invoice IDs such as SINV-2026-00001, SINV-2026-00002, and so on.

A DocType can have many series. For example, you can use one series for each branch or each type of customer. You manage the series of all DocTypes in Document Naming Settings.

Prerequisites ​

  • The System Manager role.

Add or change the series of a DocType ​

  1. Open Document Naming Settings.
  2. In Select Transaction, select the DocType, for example Sales Invoice. Series List for this Transaction shows the current series.
  3. Edit the list. Put each series on a new line. The first series is the default.
  4. Optional: select User must always select. New documents then have no default series, and users must pick one.
  5. Select Update.

Reload the page to see the new series in the documents.

To test a pattern before you use it, enter it in Try a Naming Series. Preview of generated names shows the IDs that it makes.

Write a series pattern ​

Separate the parts of a series with dots.

PartGivesExample
Fixed textThe textSINV-
#####A number with that many digits00001
.YYYY. or .YY.The year, in four or two digits2026 or 26
.MM.The month03
.DD.The day15
.JJJ.The day of the year074
.WW.The week of the year11
.FY.The fiscal year of the document's date2025-2026
.TFY.The fiscal year, in short form25-26
.ABBR.The abbreviation of the document's companyACME
.<field name>.The value of a field of the document.branch. gives the branch

ERPNext takes the year, month, and day from the current date. To use the posting date or transaction date of the document instead, select Use Posting Datetime for Naming Documents in Global Defaults. The fiscal year always follows the document's date.

Examples:

  • ACC-SINV-.YYYY.- gives ACC-SINV-2026-00001.
  • ACC-SINV-.FY.- gives a series for each fiscal year. You can also write the fiscal year as fixed text, for example ACC-SINV-25-26-.
  • PO-.YY.MM.-.vendor_id.-.#### gives PO-2603-WN-0001 when the supplier's custom Vendor ID field is WN.

TIP

A series with the year or fiscal year starts again from 1 each year. Many companies use a separate series for each fiscal year.

Set the current number of a series ​

Change the current number when you move to ERPNext from another system. For example, your old system has Sales Orders up to SO00322, and you want ERPNext to continue with SO00323.

  1. Open Document Naming Settings.
  2. In Prefix, select the prefix of the series, for example SO. Current Value shows the last number that ERPNext used.
  3. Enter the new Current Value, for example 322.
  4. Select Update Series Number.

The next document gets the number after the current value, here SO00323.

WARNING

Do not set the current value lower than the highest number in use. ERPNext then tries to reuse IDs, and fails with a duplicate name error.

Name amended documents ​

When you amend a cancelled document, ERPNext names the new document. By default, it adds a counter, so SINV-0001 becomes SINV-0001-1.

  1. In Document Naming Settings, set Default Amendment Naming:
    • Amend Counter: adds a counter to the original ID.
    • Default Naming: gives the amended document a new ID from its naming series.
  2. To use a different rule for some DocTypes, add them to the Amendment Naming Override table.
  3. Select Update Amendment Naming.

Troubleshooting ​

"Duplicate name Item Price RFD/00016" ​

Cause: ERPNext tries to give a new document an ID that already exists. The current value of the series is lower than the highest number in use. For example, someone set the current value to 15, but documents up to 22 exist.

Fix:

  1. Open the list of the DocType, for example Item Price, and find the highest ID in the series.
  2. In Document Naming Settings, select the Prefix, for example RFD/.
  3. Set Current Value to the highest number in use, for example 22.
  4. Select Update Series Number.

The same fix applies to any DocType, for example a ToDo error such as "Duplicate name ToDo TDI00014286".