New Doctyle in a New Module

Hi,

I am trying to create a New Doctype under a New Module. I am able to create the module but when saving a new doctyle under this module I get the following error :

Traceback (innermost last):
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/widgets/form/save.py", line 18, in savedocs
    doc.save()
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/model/document.py", line 216, in save
    self.run_post_save_methods()
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/model/document.py", line 442, in run_post_save_methods
    self.run_method("on_update")
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/model/document.py", line 412, in run_method
    return Document.hook(fn)(self, *args, **kwargs)
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/model/document.py", line 493, in composer
    return composed(self, method, *args, **kwargs)
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/model/document.py", line 476, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/model/document.py", line 406, in 
    fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/core/doctype/doctype/doctype.py", line 94, in on_update
    self.export_doc()
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/core/doctype/doctype/doctype.py", line 142, in export_doc
    export_to_files(record_list=[['DocType', self.name]])
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/modules/export_file.py", line 22, in export_to_files
    write_document_file(frappe.get_doc(record[0], record[1]), record_module, create_init=create_init)
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/modules/export_file.py", line 39, in write_document_file
    folder = create_folder(module, doc.doctype, doc.name, create_init)
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/modules/export_file.py", line 57, in create_folder
    module_path = get_module_path(module)
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/modules/__init__.py", line 28, in get_module_path
    return frappe.get_module_path(module)
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/__init__.py", line 389, in get_module_path
    return get_pymodule_path(local.module_app[module] + "." + module, *joins)
 KeyError: u'fixed_asset'

Traceback (innermost last):
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/app.py", line 49, in application
    response = frappe.handler.handle()
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/handler.py", line 66, in handle
    execute_cmd(cmd)
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/handler.py", line 89, in execute_cmd
    ret = frappe.call(method, **frappe.form_dict)
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/__init__.py", line 531, in call
    return fn(*args, **newargs)
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/widgets/form/save.py", line 18, in savedocs
    doc.save()
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/model/document.py", line 216, in save
    self.run_post_save_methods()
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/model/document.py", line 442, in run_post_save_methods
    self.run_method("on_update")
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/model/document.py", line 412, in run_method
    return Document.hook(fn)(self, *args, **kwargs)
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/model/document.py", line 493, in composer
    return composed(self, method, *args, **kwargs)
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/model/document.py", line 476, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/model/document.py", line 406, in 
    fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/core/doctype/doctype/doctype.py", line 94, in on_update
    self.export_doc()
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/core/doctype/doctype/doctype.py", line 142, in export_doc
    export_to_files(record_list=[['DocType', self.name]])
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/modules/export_file.py", line 22, in export_to_files
    write_document_file(frappe.get_doc(record[0], record[1]), record_module, create_init=create_init)
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/modules/export_file.py", line 39, in write_document_file
    folder = create_folder(module, doc.doctype, doc.name, create_init)
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/modules/export_file.py", line 57, in create_folder
    module_path = get_module_path(module)
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/modules/__init__.py", line 28, in get_module_path
    return frappe.get_module_path(module)
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/__init__.py", line 389, in get_module_path
    return get_pymodule_path(local.module_app[module] + "." + module, *joins)
 KeyError: u'fixed_asset' 

I know this is not advisable, rather creating a new App would be. But I am trying to create a Fixed Asset Depreciation Module and a lot of erpnext core documents would be required. So trying to create a Module and some Doctype(s) under it.

Well Basically I have a Depreciation Module already written in Java … just trying to convert it and integrate with ERPNext for our use.

Any help regarding the error??

regards
Akshay

You should create an app. You can use it to extend ERPNext.

The problem here is that the modules.txt file was not updated with the new module name. Is developer_mode set to 1 in site_config.json?

Also please share your repo link so that we get an idea of what you are doing and guide you unless you go in the wrong direction. Anything you want can be achieved usin the app architecture without changing ERPNext code.

-Anand.

Yes I am set Developer Mode to 1. Will try to create an app and return with the findings. thanks for the help.

regards
Akshay

Forgot to mention that the module name is appearing under modules.txt.

Maybe going to Help / Clear Cache might solve the problem

I think this problem is the same with i had in https://discuss.frappe.io/t/error-when-creating-custom-doctype/3830/6
is there any solution yet for this problem ?

Hi,

Sorry for not closing the topic as for me creating a new vm worked.

regards
Akshay Mehta