[FIX] point_of_sale: make card readers work again on payment screen
Swiping a credit card through pos_mercury no longer worked on the payment screen.3a74afd21eintroduced some special code in BarcodeEvents for mobile Chrome. This code relies on an invisible input being filled in by barcode device. On the payment screen the POS uses a keypress event handler on body to manage input. This handler preventsDefault which stops the input from being filled in. It's worth noting that this new approach in3a74afd21eis not fully equivalent to the original barcode events handler. Events are not redispatched, so this effectively disables keyboard input on the payment screen (or anywhere where it is used). opw-1888466 closes odoo/odoo#27820
This commit is contained in:
@@ -317,10 +317,8 @@ class MrpWorkorder(models.Model):
|
||||
if self.product_id.tracking != 'none':
|
||||
qty_to_add = float_round(self.qty_producing * move.unit_factor, precision_rounding=rounding)
|
||||
move._generate_consumed_move_line(qty_to_add, self.final_lot_id)
|
||||
elif len(move._get_move_lines()) < 2:
|
||||
move.quantity_done += float_round(self.qty_producing * move.unit_factor, precision_rounding=rounding)
|
||||
else:
|
||||
move._set_quantity_done(move.quantity_done + float_round(self.qty_producing * move.unit_factor, precision_rounding=rounding))
|
||||
move.quantity_done += float_round(self.qty_producing * move.unit_factor, precision_rounding=rounding)
|
||||
|
||||
# Transfer quantities from temporary to final move lots or make them final
|
||||
for move_line in self.active_move_line_ids:
|
||||
|
||||
@@ -34,6 +34,7 @@ var core = require('web.core');
|
||||
var rpc = require('web.rpc');
|
||||
var utils = require('web.utils');
|
||||
var field_utils = require('web.field_utils');
|
||||
var BarcodeEvents = require('barcodes.BarcodeEvents').BarcodeEvents;
|
||||
|
||||
var QWeb = core.qweb;
|
||||
var _t = core._t;
|
||||
@@ -1678,6 +1679,13 @@ var PaymentScreenWidget = ScreenWidget.extend({
|
||||
// also called explicitly to handle some keydown events that
|
||||
// do not generate keypress events.
|
||||
this.keyboard_handler = function(event){
|
||||
// On mobile Chrome BarcodeEvents relies on an invisible
|
||||
// input being filled by a barcode device. Let events go
|
||||
// through when this input is focused.
|
||||
if (BarcodeEvents.$barcodeInput && BarcodeEvents.$barcodeInput.is(":focus")) {
|
||||
return;
|
||||
}
|
||||
|
||||
var key = '';
|
||||
|
||||
if (event.type === "keypress") {
|
||||
|
||||
Reference in New Issue
Block a user