summaryrefslogtreecommitdiff
path: root/addons/barcodes/static/src/js/form_view_barcode_handler.js
diff options
context:
space:
mode:
authorJoren Van Onder <jov@odoo.com>2016-02-17 11:44:03 +0100
committerAntony Lesuisse <al@openerp.com>2016-03-17 09:39:18 +0100
commitc6fc91b3182d1651c0326ba2f491f659457b4497 (patch)
treeb847979c6db4bf7e2998ba188b43fa8a24665947 /addons/barcodes/static/src/js/form_view_barcode_handler.js
parent8639df55c0b7d7730f29dd28b2028fd0e63c027a (diff)
[IMP] stock, barcodes: make barcode operations more mobile friendly
We want to properly support devices like the Symbol MC3200. This is a handheld computer running a modern operating system like Android or Windows with an integrated barcode scanner. After installation of a modern web browser and configuration of the integrated barcode scanner Odoo works as well as it does anywhere else. The main issue with these types of devices is that the displays (and their resolution) are very small (3" @ 320x320 for Symbol MC3200). Because of this a lot of tree views become awkward to use because they require vertical scrolling. A Kanban view however scales nicely on these displays. This implements Kanban views for both the picking.form view and the stock.inventory form view because those are the views typically used when using a barcode scanner. Doing this alone is not enough, because the barcodes module does not work with Kanban views. Small changes where made to barcodes.FormViewBarcodeHandler to make it work with both List views and Kanban views.
Diffstat (limited to 'addons/barcodes/static/src/js/form_view_barcode_handler.js')
-rw-r--r--addons/barcodes/static/src/js/form_view_barcode_handler.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/addons/barcodes/static/src/js/form_view_barcode_handler.js b/addons/barcodes/static/src/js/form_view_barcode_handler.js
index 788a512dc15..ac5a74e554c 100644
--- a/addons/barcodes/static/src/js/form_view_barcode_handler.js
+++ b/addons/barcodes/static/src/js/form_view_barcode_handler.js
@@ -6,9 +6,22 @@ var utils = require('web.utils');
var common = require('web.form_common');
var BarcodeEvents = require('barcodes.BarcodeEvents');
var BarcodeHandlerMixin = require('barcodes.BarcodeHandlerMixin');
+var KanbanRecord = require('web_kanban.Record');
var _t = core._t;
+// web_kanban.Record and web.list_common.Record do not implement the
+// same interface and are thus inherently incompatible with each
+// other. Luckily barcodes keeps things pretty simple when it comes to
+// the records it wants to use. So if we give the KanbanRecord a get()
+// function that behaves like the one of web.list.Record, everything
+// is fine.
+KanbanRecord.include({
+ get: function (key) {
+ return this.values[key] && this.values[key].value;
+ },
+});
+
var FormViewBarcodeHandler = common.AbstractField.extend(BarcodeHandlerMixin, {
start: function() {
this._super();
@@ -71,6 +84,11 @@ var FormViewBarcodeHandler = common.AbstractField.extend(BarcodeHandlerMixin, {
});
}
},
+
+ _get_records: function(field) {
+ return field.viewmanager.active_view.controller.records || // tree view
+ field.viewmanager.active_view.controller.widgets; // kanban view
+ },
});
core.form_widget_registry.add('barcode_handler', FormViewBarcodeHandler);