From 27a084eb814acd81679db1e461c53389d6afc875 Mon Sep 17 00:00:00 2001 From: Nicolas Lempereur Date: Thu, 3 Jan 2019 16:53:21 +0000 Subject: [PATCH] [FIX] web: attach document fix click on firefox As of saas-11.3 there is a "Attach document" widget that is meant to more easily add attachment. But on firefox the click event is coming from the button, where on other browsers it was possibly from a child element. So the code expecting the child element did not work on firefox. opw-1920842 closes #29903 --- addons/web/static/src/js/widgets/attach_document.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/addons/web/static/src/js/widgets/attach_document.js b/addons/web/static/src/js/widgets/attach_document.js index 041b021d60b..13496f3aea7 100644 --- a/addons/web/static/src/js/widgets/attach_document.js +++ b/addons/web/static/src/js/widgets/attach_document.js @@ -11,7 +11,7 @@ var _t = core._t; var AttachDocument = Widget.extend({ template: 'AttachDocument', events: { - 'click span.o_attach_document': '_onClickAttachDocument', + 'click': '_onClickAttachDocument', 'change input.o_input_file': '_onFileChanged', }, /** @@ -76,6 +76,9 @@ var AttachDocument = Widget.extend({ * @param {Event} ev */ _onClickAttachDocument: function (ev) { + if ($(ev.target).is('input.o_input_file')) { + return; + } var fieldNames = this.getParent().canBeSaved(this.state.id); if (fieldNames.length) { return this._notifyInvalidFields(fieldNames);