Here, i will show you some example to get custom shortcuts works in odoo. you can also override default shortcuts in odoo. as you can see for that we have to create one js file in out module. the path of the file is module / static / src / js / file_js.js
and put the below code into file .
//Edit the current object F2
with this user can save the record with F2 button.
so as simple way we can also create record, delete record, make tree view to unlimited , remove the filter , open calendar and so many things using key board key.
and put the below code into file .
$.shortcut = function(key, callback, args) {$(document).keydown(function(e) {if(!args) args=[]; // IE barks when args is nullconsole.log(e.keyCode)if((e.keyCode == key.charCodeAt(0) || e.keyCode == key)) {callback.apply(this, args);return false;}});};
//Edit the current object F2
$.shortcut('113', function() {$('.oe_form_button_edit').each(function() {if($(this).parents('div:hidden').length == 0){$(this).trigger('click');}});});
with this user can save the record with F2 button.
so as simple way we can also create record, delete record, make tree view to unlimited , remove the filter , open calendar and so many things using key board key.
No comments:
Post a Comment