From 513fad42a0bdebd5378fb9472bc7084e91435884 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Wed, 31 Jan 2018 12:41:31 +0100 Subject: [FIX] barcodes: delay between keys In order to detect if a barcode scanner is being used, we detect the delay between keypresses. The value is hardcoded to 55 ms. However, in the case of a bluetooth scanner, this delay is often not enough, resulting in an incorrect capture of the barcode. We add the config parameter `barcode.max_time_between_keys_in_ms` which allows the user to fine tune this delay for his hardware. opw-806398 --- addons/barcodes/models/__init__.py | 1 + addons/barcodes/models/ir_http.py | 14 ++++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 addons/barcodes/models/ir_http.py (limited to 'addons/barcodes/models') diff --git a/addons/barcodes/models/__init__.py b/addons/barcodes/models/__init__.py index ce467f9134f..7d377d5a2b1 100644 --- a/addons/barcodes/models/__init__.py +++ b/addons/barcodes/models/__init__.py @@ -1,3 +1,4 @@ # -*- coding: utf-8 -*- import barcodes import barcode_events_mixin +from . import ir_http diff --git a/addons/barcodes/models/ir_http.py b/addons/barcodes/models/ir_http.py new file mode 100644 index 00000000000..7ff6aa7c8f2 --- /dev/null +++ b/addons/barcodes/models/ir_http.py @@ -0,0 +1,14 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +from odoo import models + + +class IrHttp(models.AbstractModel): + _inherit = 'ir.http' + + def session_info(self): + res = super(IrHttp, self).session_info() + res['max_time_between_keys_in_ms'] = int( + self.env['ir.config_parameter'].sudo().get_param('barcode.max_time_between_keys_in_ms', default='55')) + return res -- cgit v1.2.3