In previous version this js is running but in ODOO 9 it is not working, kindly upgrade this to ODOO 9
openerp.sample_report = function(instance, local) {
var _t = instance.web._t,
_lt = instance.web._lt;
var QWeb = instance.web.qweb;
var ctrl_count = 0;
$.ctrl_bind = function(key, namespace, callback, args) {
var ev = 'keydown.'+namespace;
$(document).on(ev, function(e) {
if(!args) args=[]; // IE barks when args is null
console.log(e.keyCode)
if((e.keyCode == key.charCodeAt(0) || e.keyCode == key) && e.ctrlKey) {
callback.apply(this, args);
return false;
}
});
};
$.ctrl_unbind = function(name) {
var ev = 'keydown.'+name;
$(document).off(ev);
};
instance.web.form.WidgetButton.include({
start: function() {
var self = this;
this._super.apply(this, arguments);
var context = this.build_context().eval();
if(context.shortcut != undefined){
ctrl_count++;
this.ctrl_count = ctrl_count;
$.ctrl_bind(context.shortcut, this.ctrl_count, function() {
alert(1);//for test
self.on_click();//could be used execute_action() too
});
}
},
destroy: function() {
$.ctrl_unbind(this.ctrl_count);
this._super.apply(this, arguments);
},
});
}