diff options
| author | Joren Van Onder <jov@odoo.com> | 2015-05-26 15:52:44 +0200 |
|---|---|---|
| committer | Frédéric van der Essen <fva@openerp.com> | 2015-05-29 16:29:15 +0200 |
| commit | 49d4ddd422145beee6d7bf442df9ecd0485d723d (patch) | |
| tree | 5299b4c6b9d4b122842e96affc8e35d0ad6c2cb5 /addons/web/static/src/js/web_client.js | |
| parent | 930a427ffa7e7c7f96f79cea32353fc8f6169d85 (diff) | |
[IMP] barcode_events: implement a new way of dealing with barcode events
Implement a new way of dealing with barcode events. This was necessary
because the old way of dealing with input coming from barcode devices
did not stop keyevents. This lead to all kinds of issues (eg. barcode
reader output being inserted as tender in a paymentline).
This new class inserts itself so that it handles all keyevents before
everything else. This means that it has authority on what keypress
events pass and which ones do not. It differentiates between 'real'
keyboard input and input coming from devices by buffering events. When a
certain amount of events come in fast enough, it is handled as a barcode
and a 'barcode_scanned' event is emitted on core.bus. When buffered
events are decided to not be a barcode, they are recreated and
redispatched.
Diffstat (limited to 'addons/web/static/src/js/web_client.js')
| -rw-r--r-- | addons/web/static/src/js/web_client.js | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/addons/web/static/src/js/web_client.js b/addons/web/static/src/js/web_client.js index de649d77aa2..dbd1e562810 100644 --- a/addons/web/static/src/js/web_client.js +++ b/addons/web/static/src/js/web_client.js @@ -14,6 +14,7 @@ var SystrayMenu = require('web.SystrayMenu'); var UserMenu = require('web.UserMenu'); var utils = require('web.utils'); var Widget = require('web.Widget'); +var BarcodeEvents = require('web.BarcodeEvents'); var QWeb = core.qweb; var _t = core._t; @@ -36,6 +37,7 @@ var WebClient = Widget.extend({ this.menu_dm = new utils.DropMisordered(); this.action_mutex = new utils.Mutex(); this.set('title_part', {"zopenerp": "Odoo"}); + this.barcode_events = new BarcodeEvents(); }, start: function() { var self = this; @@ -339,6 +341,9 @@ var WebClient = Widget.extend({ this.$('.oe_webclient').toggleClass( 'oe_content_full_screen', fullscreen); }, + get_barcode_events: function() { + return this.barcode_events; + } }); return WebClient; |
