Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
8448 Lượt xem

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


Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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);
}
});
}
Ảnh đại diện
Huỷ bỏ
Tác giả

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

Happy to help

Tác giả

This code works well. Thanks again.

Câu trả lời hay nhất

where to put this code please


Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 9 24
4550
2
thg 7 21
11337
0
thg 4 19
4498
2
thg 8 17
10916
1
thg 3 15
6214