Can't edit Naming Series

Guys. I can’t edit my new naming series, in Employee Doctype.
I want to add a field in the doctype for the naming series, but its not change when i save the new employee record.

The naming series i just want to add is:
EMP.-.MM.YY.-.code.-.####
I just created new field (code) in the doctype for country code. It supposed to be change something like (“my” for Malaysia) but its not change at all. it shows me EMP-0917-code.0001.

“its not change when i save the new employee record”

See if this helps:

bench set-config developer_mode 1

I believe this is a server side change so you are required to do this for such changes.

@iqbalzahir, Refer this link, might be it will helps you -

1 Like

@priya_s i’ve been looking on your shared link and refer to the link for creating my naming series. It works on another doctype, but on Employee doctype, its not changing at all.

Do you think this problem is related with HR settings (Employee Records to be created by naming series)?

Thank you @clarkej for your reply.
I’ve been doing what you said to set developer_mode 1, and the result is still the same.

@priya_s and @clarkej

here is my result:

The result of naming series is EMP-0917-code-0001. It supposed to be EMP-0917-my-0001.

So initially you saved this EMP-0917-code-0001 and now wish to change that to EMP-0917-my-0001, yes?

Well the rule here is once a naming_series is set, the database forbids you to update or replace that value, to preserve database integrity. Thereafter you can change it, but must operate directly on the database, where you assume the risk of corrupting it.

1 Like

I’m sorry but no. What is actually i want is when I create a new employee, it will change the code to be “my” not being the name of that field (code).

ah yes I see, if you add this to employee.py

def autoname(self):
       #key = "EMP.-.MM.YY.-.code.-.####"                                                                                                                
    key = self.get("autoname")
        name = frappe.model.naming.make_autoname(key)
        self.name = name.replace("code",self.code)

Does that work for you?

1 Like

Thanks @clarkej I will try later. Anything I will update soon.