Can't rename the employee id

Hello,
i have created the employee, now i want to rename the employee id but i receive below error while renaming the document

Traceback (most recent call last):
  File "apps/frappe/frappe/model/document.py", line 1614, in execute_action
    getattr(doc, __action)(**kwargs)
  File "apps/frappe/frappe/model/document.py", line 1012, in _rename
    self.name = rename_doc(doc=self, new=name, merge=merge, force=force, validate=validate_rename)
  File "apps/frappe/frappe/model/rename_doc.py", line 172, in rename_doc
    update_link_field_values(link_fields, old, new, doctype)
  File "apps/frappe/frappe/model/rename_doc.py", line 430, in update_link_field_values
    frappe.db.set_value(parent, {docfield: old}, docfield, new, update_modified=False)
  File "apps/frappe/frappe/database/database.py", line 1019, in set_value
    query.run(debug=debug)
  File "apps/frappe/frappe/query_builder/utils.py", line 87, in execute_query
    result = frappe.db.sql(query, params, *args, **kwargs)  # nosemgrep
  File "apps/frappe/frappe/database/database.py", line 244, in sql
    self._cursor.execute(query, values)
  File "env/lib/python3.10/site-packages/pymysql/cursors.py", line 153, in execute
    result = self._query(query)
  File "env/lib/python3.10/site-packages/pymysql/cursors.py", line 322, in _query
    conn.query(q)
  File "env/lib/python3.10/site-packages/pymysql/connections.py", line 563, in query
    self._affected_rows = self._read_query_result(unbuffered=unbuffered)
  File "env/lib/python3.10/site-packages/pymysql/connections.py", line 825, in _read_query_result
    result.read()
  File "env/lib/python3.10/site-packages/pymysql/connections.py", line 1199, in read
    first_packet = self.connection._read_packet()
  File "env/lib/python3.10/site-packages/pymysql/connections.py", line 775, in _read_packet
    packet.raise_for_error()
  File "env/lib/python3.10/site-packages/pymysql/protocol.py", line 219, in raise_for_error
    err.raise_mysql_exception(self._data)
  File "env/lib/python3.10/site-packages/pymysql/err.py", line 150, in raise_mysql_exception
    raise errorclass(errno, errval)
pymysql.err.OperationalError: (1292, "Truncated incorrect DECIMAL value: 'AQ23456'")

HR Setting for employee naming is as mentioned below:

Can anyone suggest the solution for that?
Thanks in Advance

1 Like

@Jignasa_Chavda first employee is created with empolyee name when you are updating with employee number so it gives you error because old employee name is value with data field and right now it is decimal so it is truncated.

2 Likes

Thanks for the response but i haven’t change any field type, i just modify the employee naming and tried to solve this

@Jignasa_Chavda please make employee number fieldtype as data field

1 Like

@Jeel


It is already a data field

@Jignasa_Chavda Aq2345 value of which field

Hi,

If you want to change default Naming Series you can use Naming Rule doctype or update naming series in employee doctype.

Naming Rule.


Hope this should fix your issue

It’s value of employee_number field

I can’t able to use this because i have a scanario in which user manually enters the empoyee id, its not fix that entered employee id should be in the continues series

Then You can use the data import option where you can import your own employee ID .

@Jignasa_Chavda can you tell me your procedure of renaming employee id

yes i understood that, once i import the records or i have manually created one record and after that when i want to rename the employee id, i am getting above mentioned error

@Jignasa_Chavda check in database

I am trying to rename the document like this way:


I guess there is no option to change the ID Once it is generated in the system.

You can only generate employee ID for a single time and it cannot be renamed .

I was able to rename this earlier

@Jignasa_Chavda in my site it’s working fine

Yes even in other cloud instance its working correctly, but i can’t able to find what’s issue in this one

@Jignasa_Chavda this employee id is set in any employee’s report to field

i don’t think the issue is that because i have tried to create new employee id and when i rename that i am getting the same error