Hello everyone!
I just wanted to ask if there is any way how to define my own keyboard shortcuts in frappe?
Thanks!
Hello everyone!
I just wanted to ask if there is any way how to define my own keyboard shortcuts in frappe?
Thanks!
Thanks! Thats exactly what I need!
i did exactly like the video but the shortcut did not show up .
custom script involves this code :
frappe.ui.keys.add_shortcut({
shortcut: "alt+ctrl+n",
description: __("Open New issue"),
action: () => {
frappe.new_doc("Issue");
}
});
hooks.py involves this :
# Includes in <head>
# ------------------
# include js, css files in header of desk.html
# app_include_css = "/assets/diamondpharma/css/diamondpharma.css"
app_include_js = "/assets/diamondpharma/public/js/custom_test.js"
it needed :
bench clear-cache
bench build
bench restart
it worked just fine
Created shortcut with same method explained in video.
But its not working.
I want to create shortcut for Session Defaults.
hooks.py
# include js, css files in header of desk.html
# app_include_css = "/assets/customization/css/customization.css"
app_include_js = "/assets/customization/js/custom.js"
I tried below code in custom.js file.
frappe.ui.keys.add_shortcut({
description: "Seesion Default",
shortcut: "shift+ctrl+k",
action: "frappe.ui.toolbar.setup_session_defaults()"
})
frappe.ui.keys.add_shortcut({
description: "Seesion Default",
shortcut: "shift+ctrl+k",
action: frappe.ui.toolbar.setup_session_defaults()
})
frappe.ui.keys.add_shortcut({
description: "Seesion Default",
shortcut: "shift+k",
action: frappe.ui.toolbar.setup_session_defaults()
})
Everytime I am reloading the page this “Session Default” dialog box is showing but keyboard shortcut is not working.
I tried bench migrate, bench build and website clear cache commands
but now this shortcut is showing.
Is Alt+K is default shortcut ?
ERPNext: v15.32.1 (version-15)
Frappe Framework: v15.37.0 (version-15)
Customization: v0.0.1 (test)
Solved:
This script worked.
frappe.ui.keys.add_shortcut({
shortcut: "shift+ctrl+k",
action: () => frappe.ui.toolbar.setup_session_defaults(),
// condition: () => this.$component.is(":visible"),
description: __("Session Default"),
ignore_inputs: true,
// page: cur_page.page.page,
});