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
15 lines
449 B
Python
15 lines
449 B
Python
# -*- 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
|