Strange issue when BOM is established in Custom Production Order Form

I have a custom form similar to Production Order with some new fields and other fields modified.
When I insert an article to manufacture, BOM must be set automatically, as in Production Order, but instead it returns this error:

Traceback (most recent call last):
  File "/home/frappe/frappe-bench/apps/frappe/frappe/app.py", line 62, in application
    response = frappe.handler.handle()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/handler.py", line 22, in handle
    data = execute_cmd(cmd)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/handler.py", line 53, in execute_cmd
    return frappe.call(method, **frappe.form_dict)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 939, in call
    return fn(*args, **newargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/handler.py", line 81, in runserverobj
    frappe.desk.form.run_method.runserverobj(method, docs=docs, dt=dt, dn=dn, arg=arg, args=args)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/desk/form/run_method.py", line 34, in runserverobj
    fnargs, varargs, varkw, defaults = inspect.getargspec(getattr(doc, method))
AttributeError: 'Document' object has no attribute 'erpnext.manufacturing.doctype.ot_gran_formato.ot_gran_formato.get_items_and_operations_from_bom'

The same happens when I set the quantity for manufacturing.

I have reviewed the PY and JS files, and everything seems correct.
In the JS file, the bom_no function is configured as follows:

bom_no: function (frm) {
    return frm.call ({
        method: "erpnext.manufacturing.doctype.ot_gran_formato.ot_gran_formato.get_items_and_operations_from_bom",
        doc: cur_frm.doc,
        freeze: true
    });
}

And, in the PY file, the get_items_and_operations_from_bom function is correctly defined.

Have I missed a step? Should I define the function in another way?
I’ve been stuck in this for a long time and I would really appreciate the help.

“erpnext.manufacturing.doctype.ot_gran_formato.ot_gran_formato”
looks like it should probably be
“erpnext.manufacturing.doctype.ot_gran_formato”

The rest of the code has a similar syntax and shows no errors. It only happens to me with that function.
Anyway, I’ve tried it with erpnext.manufacturing.doctype.ot_gran_formato and it’s still throwing the same error.