CORS Issue in frappe

I am having an issue using in ERPNext v12. the error is down below.

The one in the right is the error and the one circled in green is the method being called in Does anyone know how to resolve this?

Can you please provide the JavaScript and Python code here? We need to see the code to understand the issue because we’re not familiar with how to use it in

Hi @NCP ,

Here is the Javascript code.

frappe.listview_settings['Item'] = {
    refresh : function(listview) {"Rename Item", function(){

function ButtonFunction(listview) {{
        method: 'tan_maufacturing_customizations.tan_maufacturing_customizations.renaming_item.rename_item',
        callback: function(r) {

And here is the Python code…

import frappe

def rename_item():
    new_names = []
    items = frappe.db.get_list('Item', filters={'item_group': 'Dairy and Chilled' }, pluck='name')
    for index in range(len(items)):
        new_name = 'CHLD' + calculate_number_len(index + 1) + str(index + 1)
        # frappe.db.set_value('Item', items[index], 'name', new_name)
        return new_names

def calculate_number_len(num):
    num_of_zero = 6
    series = num_of_zero - len(str(num))
    return "0" * series

Maybe it’s not possible to rename on listview in v12.

If you want to rename, then use form view script. otherwise check it.

Thank You!

Hi I tried doing this in the Item form view but it still gives me the same error.

Hi @Rabie_Moses_Santill1,

We don’t know if the code structure is correct in version 12 as many functionalities have been updated in newer versions. And support for versions 13 or below has been discontinued.

For more information, please refer to the guidelines.

Thank You!

Oh ok. Thanks btw.