Error when saving a doctype transaction

Getting the following error when the adding rows to child table by javascript. Rows are being added fine but when i’m saving the document i’m getting the error

Traceback (most recent call last):
File “frappe-bench/apps/frappe/frappe/desk/form/save.py”, line 12, in savedocs
doc = frappe.get_doc(json.loads(doc))
File “frappe-bench/apps/frappe/frappe/init.py”, line 578, in get_doc
return frappe.model.document.get_doc(arg1, arg2)
File “frappe-bench/apps/frappe/frappe/model/document.py”, line 47, in get_doc
return controller(arg1, arg2)
File “frappe-bench/apps/frappe/frappe/model/document.py”, line 83, in init
super(Document, self).init(arg1)
File “frappe-bench/apps/frappe/frappe/model/base_document.py”, line 50, in init
self.update(d)
File “frappe-bench/apps/frappe/frappe/model/base_document.py”, line 73, in update
self.set(key, value)
File “frappe-bench/apps/frappe/frappe/model/base_document.py”, line 120, in set
self.extend(key, value)
File “frappe-bench/apps/frappe/frappe/model/base_document.py”, line 146, in extend
self.append(key, v)
File “frappe-bench/apps/frappe/frappe/model/base_document.py”, line 134, in append
value = self._init_child(value, key)
File “frappe-bench/apps/frappe/frappe/model/base_document.py”, line 161, in _init_child
value = get_controller(value[“doctype”])(value)
File “frappe-bench/apps/frappe/frappe/model/base_document.py”, line 32, in get_controller
module = load_doctype_module(doctype, module_name)
File “frappe-bench/apps/frappe/frappe/modules/init.py”, line 64, in load_doctype_module
doctype_python_modules[key] = frappe.get_module(get_module_name(doctype, module, prefix, suffix))
File “frappe-bench/apps/frappe/frappe/init.py”, line 643, in get_module
return importlib.import_module(modulename)
File “/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/init.py”, line 37, in import_module
import(name)
ImportError: No module named cp___00001.cp___00001

Traceback (most recent call last):
File “frappe-bench/apps/frappe/frappe/app.py”, line 55, in application
response = frappe.handler.handle()
File “frappe-bench/apps/frappe/frappe/handler.py”, line 19, in handle
execute_cmd(cmd)
File “frappe-bench/apps/frappe/frappe/handler.py”, line 36, in execute_cmd
ret = frappe.call(method, **frappe.form_dict)
File “frappe-bench/apps/frappe/frappe/init.py”, line 879, in call
return fn(*args, **newargs)
File “frappe-bench/apps/frappe/frappe/desk/form/save.py”, line 12, in savedocs
doc = frappe.get_doc(json.loads(doc))
File “frappe-bench/apps/frappe/frappe/init.py”, line 578, in get_doc
return frappe.model.document.get_doc(arg1, arg2)
File “frappe-bench/apps/frappe/frappe/model/document.py”, line 47, in get_doc
return controller(arg1, arg2)
File “frappe-bench/apps/frappe/frappe/model/document.py”, line 83, in init
super(Document, self).init(arg1)
File “frappe-bench/apps/frappe/frappe/model/base_document.py”, line 50, in init
self.update(d)
File “frappe-bench/apps/frappe/frappe/model/base_document.py”, line 73, in update
self.set(key, value)
File “frappe-bench/apps/frappe/frappe/model/base_document.py”, line 120, in set
self.extend(key, value)
File “frappe-bench/apps/frappe/frappe/model/base_document.py”, line 146, in extend
self.append(key, v)
File “frappe-bench/apps/frappe/frappe/model/base_document.py”, line 134, in append
value = self._init_child(value, key)
File “frappe-bench/apps/frappe/frappe/model/base_document.py”, line 161, in _init_child
value = get_controller(value[“doctype”])(value)
File “frappe-bench/apps/frappe/frappe/model/base_document.py”, line 32, in get_controller
module = load_doctype_module(doctype, module_name)
File “frappe-bench/apps/frappe/frappe/modules/init.py”, line 64, in load_doctype_module
doctype_python_modules[key] = frappe.get_module(get_module_name(doctype, module, prefix, suffix))
File “frappe-bench/apps/frappe/frappe/init.py”, line 643, in get_module
return importlib.import_module(modulename)
File “/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/init.py”, line 37, in import_module
import(name)
ImportError: No module named cp___00001.cp___00001

@rohit_w can you please help?

Hi @Sai_Sasank,

Can your share your script.

It has been resolved. Its my mistake.
In frappe.model.add_child(frm.doc, “doctype_name”, “table_name”), for doctype_name i have been using frm.docname and because of that i got the error.
Everything was working fine when i changed frm.docname to the name of the child table