From 7813a8e714f268983b0be88827ae1c8ad887e6c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20Ku=CC=88hn?= Date: Mon, 8 Jan 2018 22:08:21 +0100 Subject: [FIX] web: binaryfile field in list views Revert partially 255e8ca3d92e3a77d7c2a145677623518bc2f978 Removed widget 'download_link', as it was a sub-version of widget 'binary': it did the exact same thing (representation of binary fields by means of a download link) in a much better-looking way (download icon + filename as text of the download link, instead of just a download link with text "Download"). Also, the values of binary fields might be already a human-readable binsize (e.g. 2.52 MBs), instead of its plain textual string representation in base64: The contextual parameter 'bin_size', when set to true, does not download the data of binary fields. As a consequence, the server provides the sizes of the binary, instead of their value. --- .../web/static/tests/fields/basic_fields_tests.js | 34 ---------------------- 1 file changed, 34 deletions(-) (limited to 'addons/web/static/tests/fields/basic_fields_tests.js') diff --git a/addons/web/static/tests/fields/basic_fields_tests.js b/addons/web/static/tests/fields/basic_fields_tests.js index a2f59a68e2a..9ea423250e4 100644 --- a/addons/web/static/tests/fields/basic_fields_tests.js +++ b/addons/web/static/tests/fields/basic_fields_tests.js @@ -1481,40 +1481,6 @@ QUnit.module('basic_fields', { session.get_file = oldGetFile; }); - QUnit.test('download_link widget in list view', function (assert) { - assert.expect(5); - - this.data.partner.fields.filename = { string: "Filename", type: "char" }; - this.data.partner.records[0].filename = "document.txt"; - - var form = createView({ - View: ListView, - model: 'partner', - data: this.data, - arch: '' + - '' + - '' + - '', - res_id: 1, - }); - - assert.ok(form.$('.o_data_cell').first().hasClass("o_download_link_cell"), - "this should be a download link cell"); - assert.ok(form.$('.o_data_cell').first().find('a').eq(0), - "there should be a link in the cell"); - assert.strictEqual(form.$('.o_data_cell').first().find('a').eq(0).attr('download'), - "document.txt", - "it should download a file named 'document.txt'"); - assert.strictEqual(form.$('.o_data_cell').first().find('a').eq(0).attr('href').trim(), - "data:application/octet-stream;base64,coucou==", - "it should have the appropriate link of a binary"); - assert.strictEqual(form.$('.o_data_cell').first().find('a').eq(0).text(), - "Download", - "the text of the link should be 'Download'"); - - form.destroy(); - }); - QUnit.test('text field rendering in list view', function (assert) { assert.expect(1); -- cgit v1.2.3