Odoo Help

1

How to modify the behavior of the « enter » key in the PoS interface?

By
Pascal Tremblay
on 11/25/15, 4:04 PM 1,164 views

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


1
Axel Mendoza
On 11/25/15, 8:13 PM

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);
}
});
}

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

Pascal Tremblay
on 11/25/15, 8:37 PM

Happy to help

Axel Mendoza
on 11/25/15, 8:42 PM

This code works well. Thanks again.

Pascal Tremblay
on 12/7/15, 3:54 PM

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

2 follower(s)

Stats

Asked: 11/25/15, 4:04 PM
Seen: 1164 times
Last updated: 11/26/15, 1:36 AM