Hello,
How can I use a custom script, for insert data to DB or other?
And run it directly for once after Setup Wizard is completed!
Can I use patches for this?
Thanks
@OmarJaber
If you have custom app
use after_install
from hooks.py
Not sure but you can try that after_install
to create your documents.
app_license = "MIT"
app_logo_url = "/assets/frappe/images/frappe-framework-logo.svg"
develop_version = "15.x.x-develop"
app_email = "developers@frappe.io"
docs_app = "frappe_docs"
translator_url = "https://translate.erpnext.com"
before_install = "frappe.utils.install.before_install"
after_install = "frappe.utils.install.after_install"
page_js = {"setup-wizard": "public/js/frappe/setup_wizard.js"}
# website
app_include_js = [
"libs.bundle.js",
"desk.bundle.js",
"list.bundle.js",
1 Like
This is not working
after_install
run after installing the app on the site, not after finish the Setup Wizard
@OmarJaber
Try setup_wizard_complete
event in hooks.py
.
doctype_js = {
"Address": "public/js/address.js",
"Communication": "public/js/communication.js",
"Event": "public/js/event.js",
"Newsletter": "public/js/newsletter.js",
"Contact": "public/js/contact.js",
}
override_doctype_class = {"Address": "erpnext.accounts.custom.address.ERPNextAddress"}
welcome_email = "erpnext.setup.utils.welcome_email"
# setup wizard
setup_wizard_requires = "assets/erpnext/js/setup_wizard.js"
setup_wizard_stages = "erpnext.setup.setup_wizard.setup_wizard.get_setup_stages"
setup_wizard_test = "erpnext.setup.setup_wizard.test_setup_wizard.run_setup_wizard_test"
before_install = "erpnext.setup.install.check_setup_wizard_not_completed"
after_install = "erpnext.setup.install.after_install"
]
stages += get_stages_hooks(args) + get_setup_complete_hooks(args)
stages.append(
{
# post executing hooks
"status": "Wrapping up",
"fail_msg": "Failed to complete setup",
"tasks": [
{"fn": run_post_setup_complete, "args": args, "fail_msg": "Failed to complete setup"}
],
}
)
return stages
@frappe.whitelist()
def setup_complete(args):
"""Calls hooks for `setup_wizard_complete`, sets home page as `desktop`
1 Like
Yes, I use this event and its OK with me
thanks