[Solved] Global name 'res' is not defined in a Custom Controller

Hi Guys, I need some help.

I trying to create a custom app, I have a field “Production Item” like in Work Order and I want to get the default BOM for it but I have this error

Traceback (most recent call last):
  File "/home/frappe/frappe-bench/apps/frappe/frappe/app.py", line 61, in application
    response = frappe.handler.handle()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/handler.py", line 21, in handle
    data = execute_cmd(cmd)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/handler.py", line 56, in execute_cmd
    return frappe.call(method, **frappe.form_dict)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 1032, in call
    return fn(*args, **newargs)
  File "/home/frappe/frappe-bench/apps/service_manager/service_manager/service_manager/doctype/repair_order/repair_order.py", line 19, in get_item_details
    res = {}
NameError: global name 'res' is not defined

Right now I only have a test code, my JS file has

production_item: function(frm) {
    if (frm.doc.production_item) {
                    method: "service_manager.service_manager.doctype.repair_order.repair_order.get_item_details",
                    args: {
                            item: frm.doc.production_item,
                            project: frm.doc.project
                    freeze: true,
                    callback: function(r) {
                             if(r.message) {
                                     frm.set_value('sales_order', "");
                                     erpnext.in_production_item_onchange = true;
                                     $.each(["description", "stock_uom", "project", "bom_no",
                                             "allow_alternative_item", "transfer_material_against"], function(i, field) {
                                             frm.set_value(field, r.message[field]);
                                     erpnext.in_production_item_onchange = false;

and my PY file is

# -*- coding: utf-8 -*-
# Copyright (c) 2019, Riders and contributors
# For license information, please see license.txt

from __future__ import unicode_literals
import frappe
import json
from frappe import _
from frappe.utils import flt, get_datetime, getdate, date_diff, nowdate
from frappe.model.document import Document
from erpnext.manufacturing.doctype.bom.bom import validate_bom_no, get_bom_items_as_dict
from erpnext.stock.doctype.item.item import validate_end_of_life

class RepairOrder(Document):

def get_item_details(item, project = None):
    res = {}
    return {}

I’m new with erpnext development, some body can help me ?

Best Regards and Thank you in advance

From the code, it doesn’t seem like this should be problem, try clearing your pycache files

@trungus try bench restart command to clear the cache of PY files

@scmmishra and @ROHAN_JAIN1, Thanks to both it’s work