The correct way to setup custom module

Is this the correct way to setup the custom module for erp next?
The ‘app name’ should put as erpnext?

Should i add to the module.txt?

cause after i add, i have the error as below:

Traceback (most recent call last):
File “/usr/lib/python2.7/”, line 174, in _run_module_as_main
main”, fname, loader, pkg_name)
File “/usr/lib/python2.7/”, line 72, in _run_code
exec code in run_globals
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/utils/”, line 79, in
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/utils/”, line 16, in main
File “/home/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/click/”, line 722, in call
return self.main(*args, **kwargs)
File “/home/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/click/”, line 697, in main
rv = self.invoke(ctx)
File “/home/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/click/”, line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/click/”, line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/click/”, line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/home/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/click/”, line 535, in invoke
return callback(*args, **kwargs)
File “/home/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/click/”, line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/commands/”, line 24, in _func
ret = f(frappe._dict(ctx.obj), *args, **kwargs)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/commands/”, line 210, in migrate
migrate(context.verbose, rebuild_website=rebuild_website)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/”, line 33, in migrate
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/model/”, line 19, in sync_all
sync_for(app, force, verbose=verbose, reset_permissions=reset_permissions)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/model/”, line 38, in sync_for
folder = os.path.dirname(frappe.get_module(app_name + “.” + module_name).file)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/”, line 672, in get_module
return importlib.import_module(modulename)
File “/usr/lib/python2.7/importlib/”, line 37, in import_module
ImportError: No module named asset_setup

I able to create custom docType for selling module( which is default) and it is working fine.
But if i create custom docType under ‘Asset Setup’ (which is custom module)
I am having this error.

Can someone help urgently.

Hi, ideally you should create a custom app. Refer to Bench Commands Cheatsheet for commands to create a new app and install it in your site.

i follow your guide and run the command as below:
bench new-app myapp
bench install-app myapp
bench migrate

After that, the below error occur.

How i able to fix this.

Even if i bench uninstall-app myapp and remove it from sites/apps.txt.
The error still shown there.
How i revert or fix this, so i can get back to screen of erp next. I did a lot of customization in form and validation. I don’t want to redo all again >.<.

bench restart solve the problem.

Commands like install-app and uninstall-app should be called with the --site flag, like this:

bench --site sitename install-app appname

Also, make sure the traceback doesn’t get cropped while taking a screenshot next time.

1 Like

thanks for help bro.

1 Like