Back up your Naming Series before migrating

Hello Community,

There’s a little something we would like you to take care of before you migrate to version 11. The Naming Series have been refactored in version 11, so as per the patch, it will preserve all the Naming Series you have used till date in your transactions and will set the options for Naming Series accordingly.

As informed by @adityaduggal, it causes a bit of an issue as many people might not currently be using the series which they might have used and it can cause confusion after the migration as you get all the preserved series of that DocType in the options for setting the Naming Series. So, to avoid this, please do take a back up of the Naming Series of the DocTypes you are currently using / going to use and import them once you migrate to version 11.

That’s it.

Cheers,
Shreya.

7 Likes

Sounds like V11 stable will be released soon :wink:

How to backup naming series, is the real question a guide that would have been great?

Exporting Property Setter should work to take backup of naming series.

1 Like

@kolate_sambhaji Yep.

Running the below lines of code by opening the bench console before migrating,

def doctypes():
 def series_backup(doctype):
  orig = frappe.db.get_value('DocField', {'parent': doctype, 'fieldname': 'naming_series'}, ['options'])
  orig = orig.split('\n') if orig else []

  prop = frappe.db.get_value('Property Setter', {'doc_type': doctype, 'field_name': 'naming_series', 'property': 'options'}, ["value"])
  prop = prop.split('\n') if prop else []
  
  combined = list(set(orig + prop))
  return combined


 from erpnext.patches.v11_0.refactor_naming_series import doctype_series_map
 preserve_current = {}
 for d in doctype_series_map:
     preserve_current[d] = series_backup(d)

 print(preserve_current)

Save the output somewhere and then it could be imported whenever a confusion arises with any DocType (which seems like a rare case).

@shreya115,

In above post, it is mentioned

Running the below lines of code by opening the bench console before migrating,

It gives
ImportError: No module named v11_0.refactor_naming_series

Am i missing the flow? thanks