diff options
| author | Nicolas Lempereur <nle@odoo.com> | 2018-08-07 17:19:57 +0200 |
|---|---|---|
| committer | Nicolas Lempereur <nle@odoo.com> | 2018-08-17 15:33:40 +0200 |
| commit | ac1e187eea33266095f49a9e1e1ea6b0698be865 (patch) | |
| tree | 74d7fed6ac1b388f1875abc363a130a35f27f55c /addons/document/static/tests/document_tests.js | |
| parent | 80118dd8a24249e5e008eae1178fccfc9ba68fb4 (diff) | |
[FIX] document: no query attachment out of form view
Since cce70fd4 the attachment menu is only displayed for form view.
But if in another view there is active_ids (eg. selecting record in a
list view), we will still make a query to ir.attachment without using
the result.
Without the code change, the added test would fail when doing a
search_read RPC call to ir.attachment model.
related to #26213
Diffstat (limited to 'addons/document/static/tests/document_tests.js')
| -rw-r--r-- | addons/document/static/tests/document_tests.js | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/addons/document/static/tests/document_tests.js b/addons/document/static/tests/document_tests.js index 9fd1e7d25ae..cc6f2668fc5 100644 --- a/addons/document/static/tests/document_tests.js +++ b/addons/document/static/tests/document_tests.js @@ -3,6 +3,7 @@ odoo.define('document.tests', function (require) { var testUtils = require('web.test_utils'); var FormView = require('web.FormView'); + var ListView = require('web.ListView'); var createView = testUtils.createView; @@ -16,6 +17,9 @@ odoo.define('document.tests', function (require) { records: [{ id: 1, display_name: "first record", + }, { + id: 2, + display_name: "second record", }] }, 'ir.attachment': { @@ -74,5 +78,34 @@ odoo.define('document.tests', function (require) { assert.strictEqual(form.sidebar.$('.o_sidebar_delete_attachment').length, 1, "there should be only one attachment"); form.destroy(); }); + + QUnit.test('no attachment on list view', function (assert) { + assert.expect(4); + + var list = createView({ + View: ListView, + model: 'partner', + data: this.data, + groupBy: ['display_name'], + viewOptions: {sidebar: true}, + arch: '<tree string="Partners">' + + '<field name="display_name"/>' + + '</tree>', + mockRPC: function (route, args) { + assert.step(args.model); + return this._super.apply(this, arguments); + } + }); + + // select record then trigger render + list.$('.o_group_header:last').click(); + list.$('.o_data_row input').click(); + list.$('.o_group_header:first').click(); + + assert.verifySteps(['partner', 'partner', 'partner'], + "ir.attachment not called when selecting record in list view"); + + list.destroy(); + }); }); }); |
