From 28a9336ac827da0cfd100793ef7f0347c964fed7 Mon Sep 17 00:00:00 2001
From: Joren Van Onder <jov@odoo.com>
Date: Tue, 10 May 2016 11:08:46 +0200
Subject: [PATCH] [FIX] barcodes: also allow barcodes triggering buttons in
 dropdowns

On smaller screens some buttons will be hidden. An example of this is
the 'Validate' button in the stock.picking form view. It is not :visible
but it should still be possible to trigger through scanning a
'O-BTN.validate' barcode.

opw-676741
---
 addons/barcodes/static/src/js/inherited_form_widget_button.js | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/addons/barcodes/static/src/js/inherited_form_widget_button.js b/addons/barcodes/static/src/js/inherited_form_widget_button.js
index bf2ea1bbd359..79cf6deb8234 100644
--- a/addons/barcodes/static/src/js/inherited_form_widget_button.js
+++ b/addons/barcodes/static/src/js/inherited_form_widget_button.js
@@ -15,7 +15,8 @@ var ButtonBarcodeHandlerMixin = _.extend({}, BarcodeHandlerMixin, {
             var self = this;
             this.on_barcode_scanned = function(barcode) {
                 var match = barcode.match(/O-BTN\.(.+)/);
-                if (match && match[1] === self.node.attrs.barcode_trigger && self.$el.is(':visible')) {
+                if (match && match[1] === self.node.attrs.barcode_trigger &&
+                    (self.$el.is(':visible') || self.$el.parent('.dropdown-menu'))) {
                     self.on_click();
                 }
             };
-- 
GitLab