summaryrefslogtreecommitdiff
path: root/addons/barcodes/models
diff options
context:
space:
mode:
authorNicolas Martinelli <nim@odoo.com>2018-01-31 12:41:31 +0100
committerNicolas Martinelli <nim-odoo@users.noreply.github.com>2018-01-31 13:47:17 +0100
commit513fad42a0bdebd5378fb9472bc7084e91435884 (patch)
treeb8521fdf5afd9797c05f585f77e5c847ffbebce9 /addons/barcodes/models
parentd295b4360db93a0d3333153098e623e573ac099b (diff)
[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
Diffstat (limited to 'addons/barcodes/models')
-rw-r--r--addons/barcodes/models/__init__.py1
-rw-r--r--addons/barcodes/models/ir_http.py14
2 files changed, 15 insertions, 0 deletions
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