From fc82e1e40abd8092e6a044dc4e78432beffb5149 Mon Sep 17 00:00:00 2001 From: Martin Geubelle Date: Fri, 19 May 2017 17:25:59 +0200 Subject: [PATCH] [FIX] mrp: correctly replace inputs in pdf_viewer widget In the extended template `HiddenInputFile` there are actually two inputs (one for image only and another one). This widget needs to replace both of them otherwise the file selector will be opened twice. --- addons/mrp/static/src/xml/mrp.xml | 6 ++++-- addons/mrp/static/tests/mrp_tests.js | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/addons/mrp/static/src/xml/mrp.xml b/addons/mrp/static/src/xml/mrp.xml index 54b1bb6fc9b..5a1c9353084 100644 --- a/addons/mrp/static/src/xml/mrp.xml +++ b/addons/mrp/static/src/xml/mrp.xml @@ -16,8 +16,10 @@ - - + + + + diff --git a/addons/mrp/static/tests/mrp_tests.js b/addons/mrp/static/tests/mrp_tests.js index ed4dab4f91b..40f6fc2607b 100644 --- a/addons/mrp/static/tests/mrp_tests.js +++ b/addons/mrp/static/tests/mrp_tests.js @@ -31,7 +31,7 @@ QUnit.module('mrp', { }, }, function () { QUnit.test("pdf_viewer without data", function (assert) { - assert.expect(3); + assert.expect(4); var form = createView({ View: FormView, @@ -48,6 +48,8 @@ QUnit.module('mrp', { "there should be a visible 'Upload' button"); assert.ok(form.$('.o_field_widget iframe.o_pdfview_iframe').hasClass('o_hidden'), "there should be an invisible iframe"); + assert.strictEqual(form.$('input[type="file"]').length, 1, + "there should be one input"); form.destroy(); });