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/runpy.py”, line 174, in _run_module_as_main
main”, fname, loader, pkg_name)
File “/usr/lib/python2.7/runpy.py”, line 72, in _run_code
exec code in run_globals
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 79, in
main()
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 16, in main
click.Group(commands=commands)(prog_name=‘bench’)
File “/home/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 722, in call
return self.main(*args, **kwargs)
File “/home/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 697, in main
rv = self.invoke(ctx)
File “/home/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, 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/core.py”, 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/core.py”, line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/home/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 535, in invoke
return callback(*args, **kwargs)
File “/home/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/click/decorators.py”, line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/commands/init.py”, line 24, in _func
ret = f(frappe._dict(ctx.obj), *args, **kwargs)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/commands/site.py”, line 210, in migrate
migrate(context.verbose, rebuild_website=rebuild_website)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/migrate.py”, line 33, in migrate
frappe.model.sync.sync_all(verbose=verbose)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/model/sync.py”, line 19, in sync_all
sync_for(app, force, verbose=verbose, reset_permissions=reset_permissions)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/model/sync.py”, 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/init.py”, line 672, in get_module
return importlib.import_module(modulename)
File “/usr/lib/python2.7/importlib/init.py”, line 37, in import_module
import(name)
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.
:persevere:

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.

@Sagar_Vora
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