Skip to Content
Menu
You need to be registered to interact with the community.
This question has been flagged
2 Odgovori
8469 Prikazi

Hello all,

See the screen below. At this place, by default, the « enter » key of the keyboard has the same behavior than a click on the « Validate » button. 

We rather want that the « enter » key simulate a click of the « Invoice » button.

How to achieve this?

Thanks


Avatar
Opusti
Best Answer

Hi @Pascal Tremblay

Here is how:

openerp.pos_test = function (instance) {
var _t = instance.web._t,
_lt = instance.web._lt;
var QWeb = instance.web.qweb;

instance.point_of_sale.PaymentScreenWidget.include({
init: function(parent, options) {
var self = this;
this._super(parent,options);
document.body.removeEventListener('keyup',this.hotkey_handler);
this.hotkey_handler = function(event){
if(event.which === 13){
self.validate_order({invoice: true});
}else if(event.which === 27){
self.back();
}
};
document.body.addEventListener('keyup', this.hotkey_handler);
}
});
}
Avatar
Opusti
Avtor

Thanks 1000 times. I could never code it myself! Ouf!

Happy to help

Avtor

This code works well. Thanks again.

Best Answer

where to put this code please


Avatar
Opusti
Related Posts Odgovori Prikazi Aktivnost
2
sep. 24
4587
2
jul. 21
11358
0
apr. 19
4508
2
avg. 17
10927
1
mar. 15
6218