As @Mohammed_Redha said you have to write it in python file (server side).
you can use hooks.py
for it.
In hooks.py
give an autoname function path for Item
.
"Item": {
"autoname": "dotted.path.to.autoname.function"
}
Where your method will be like, (In Python file)
def item_autoname(doc, method):
from frappe.model.naming import make_autoname
doc.name = make_autoname(doc.item_code + '-.#####')
Hope it resolve your problem.