Hello,
I want to introduce more short keys like Ctrl+S to save and Ctrl+B to New Form.
Hello,
I want to introduce more short keys like Ctrl+S to save and Ctrl+B to New Form.
Thank you @max_morais_dmm,
I want to add some shortkeys like
Ctrl+shift+d to open doctype of the form,
Ctrl+shift+s to open custom script of the form.
Ctrl +d to duplicate the form etc.
How do i achieve that?
@max_morais_dmm
I’ve tried this piece of code for Ctrl+i for duplicate but not working.
frappe.ui.keys.on('ctrl+i', function(e) {
if(in_list(frappe.boot.user.can_create, me.frm.doctype) && !me.frm.meta.allow_copy) {
me.frm.copy_doc();
}
});
@shahid, frappe have already builting functions for permissions:
Also, probably your code is not working, due some unaccessible namespace or variable, like me
and me.frm
This is also not working.
frappe.ui.keys.on('ctrl+i', function(e) {
frappe.msgprint("Working..");
});
But working when i am calling it via custom script in form.
not working globally.
You need to make sure that you are also disabling the browser default key combination with this:
e.preventDefault();
So try this for duplicating and let me know:
frappe.ui.keys.on('ctrl+d', function(e) {
var route = frappe.get_route();
console.log("CTRL+D was pressed");
if(route[0]==='Form' || route[0]==='List') {
cur_frm.copy_doc();
e.preventDefault();
return false;
}
});
Hello;
I need to do same thing (but another shortcut key) but to work on the child table, so if I am standing on row#3 at item_code field and I pressed F1 or F2 or Shift+i, then I need to know which row of the child table that I am standing at it when I pressed this shortcut key and then I need to run script. How I can do this?
Regards
Bilal