summaryrefslogtreecommitdiff
path: root/addons/barcodes
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2016-10-17 15:17:48 +0200
committerChristophe Simonis <chs@odoo.com>2016-10-17 15:17:48 +0200
commite8e4145c998c335d00a48a0b2a7a9e961b3f3983 (patch)
tree3433987f901989e6103f30d165580a87ce4f658f /addons/barcodes
parent81ec36a709188e1e8fe0fb28e0673396d9b51e4d (diff)
parentba6ca788fd80a1b963b8059bd287317399389283 (diff)
[MERGE] forward port branch saas-11 up to ba6ca78
Diffstat (limited to 'addons/barcodes')
-rw-r--r--addons/barcodes/static/src/js/form_view_barcode_handler.js11
1 files changed, 8 insertions, 3 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 b00bce51c5e..ffc6dfc7383 100644
--- a/addons/barcodes/static/src/js/form_view_barcode_handler.js
+++ b/addons/barcodes/static/src/js/form_view_barcode_handler.js
@@ -81,7 +81,7 @@ var FormViewBarcodeHandler = common.AbstractField.extend(BarcodeHandlerMixin, {
if (this.last_scanned_barcode) {
var new_qty = window.prompt(_t('Set quantity'), character) || "0";
new_qty = new_qty.replace(',', '.');
- var record = this._get_records(field).find(function(record) {
+ var record = _.find(this._get_records(field), function (record) {
return record.get('product_barcode') === self.last_scanned_barcode;
});
if (record) {
@@ -159,8 +159,13 @@ 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
+ var active_view = field.viewmanager.active_view;
+ if (active_view.type === "kanban") {
+ return active_view.controller.widgets;
+ } else {
+ // tree view case
+ return active_view.controller.records.records;
+ }
},
});