From 6647e1f8a98b0fac4310a17c016df0a1a33e13b7 Mon Sep 17 00:00:00 2001 From: Simon Lejeune Date: Thu, 15 Sep 2016 16:17:17 +0200 Subject: [PATCH] [FIX] barcodes: correctly unbind quantity event listener The quantity event handler is not correctly unbound when its action is deleted, resulting in multiple window.prompt asking the quantity of the products if you go mulitple times trough a view when a widget implementing the barcode thing is used. There seems to be a bug in the framework ("barcode_scanned" events are registered the same way than the "keypress" one on core.bus but they don't have suffer from the same issue). --- addons/barcodes/static/src/js/form_view_barcode_handler.js | 5 +++++ 1 file changed, 5 insertions(+) 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 a6fa4b55adf..b00bce51c5e 100644 --- a/addons/barcodes/static/src/js/form_view_barcode_handler.js +++ b/addons/barcodes/static/src/js/form_view_barcode_handler.js @@ -52,6 +52,11 @@ var FormViewBarcodeHandler = common.AbstractField.extend(BarcodeHandlerMixin, { } }, + destroy: function () { + this.stop_listening(); + this._super.apply(this, arguments); + }, + _display_no_edit_mode_warning: function() { this.do_warn(_t('Error : Document not editable'), _t('To modify this document, please first start edition.')); },