Accessing sales invoice using keyboard shortcut instead of mouse

Is it possible to access some documents using keyboard shortcut instead of navigating using mouse?
For example, while I am in HR module, I need to create new sales invoice or I need to access the general ledger GL, I do not need to navigate through mouse, I need to type shortcut key (for example F3 or F4 or combination of F key with any character), it will open the needed document. Is it possible?

You can capture Key Events with JavaScript.

Also, this library does so much of the work for you:

So I have to write code for this?

Yes…You need to do it thru code…There’s not an option on ERPNEXT to configure that behavior.

Here’s a hack (I’m a horrible coder so bear with me):

If you are in the Item Form, you could add this custom script to create a new invoice from there by using the + key in the numeric pad:

frappe.ui.form.on("Item", {
refresh: function(frm) {
    $(document).keyup(function(e) {
        if (e.which === 107) { // Use + on numeric keypad 
			// frappe.set_route('List', 'Sales Invoice');  //take the user to the list of Invoices
			frappe.new_doc("Sales Invoice");  //create a New Invoice
			// frappe.msgprint("TEST MESSAGE");  //show a custom message


Hope this helps…

Bear with you :slight_smile:

  • Why did you use === and did not use ==? And what is the 107? Is it the ascii code for the + or what exactly? Because as I know that the ascii code of + is 043.

Thanks for the kindly help.

Just wanted to enforce the comparison…You can take a look at this thorough article about it Equality comparisons and sameness - JavaScript | MDN

As for the code, I got it from here: KeyboardEvent Value (keyCodes, metaKey, etc) | CSS-Tricks - CSS-Tricks