From de48daf53adc922da6b2ff4ef794e37b0b7cd835 Mon Sep 17 00:00:00 2001 From: Pratima Gupta Date: Thu, 17 Aug 2017 12:29:21 +0530 Subject: [FIX] web: FieldDomain: don't open record from selection The FieldDomain allows to open a list in a dialog to display the records matching the current domain. In this dialog, clicking on a record should do nothing (this was the behavior before the new views). Before this rev., it actually tried to open the record and it produced a crash. --- .../web/static/tests/fields/basic_fields_tests.js | 40 ++++++++++++++++++++++ 1 file changed, 40 insertions(+) (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 c33cb8a4151..90f2b14cb01 100644 --- a/addons/web/static/tests/fields/basic_fields_tests.js +++ b/addons/web/static/tests/fields/basic_fields_tests.js @@ -3795,6 +3795,46 @@ QUnit.module('basic_fields', { form.destroy(); }); + + QUnit.test('basic domain field: show the selection', function (assert) { + assert.expect(2); + + this.data.partner.records[0].foo = "[]"; + + var form = createView({ + View: FormView, + model: 'partner', + data: this.data, + arch: + '
' + + '' + + '' + + '' + + '' + + '' + + '
', + archs: { + 'partner_type,false,list': '', + 'partner_type,false,search': '', + }, + res_id: 1, + }); + + assert.equal(form.$(".o_domain_show_selection_button").text().trim().substr(0, 2), "2 ", + "selection should contain 2 records"); + + // open the selection + form.$(".o_domain_show_selection_button").click(); + assert.strictEqual($('.modal .o_list_view .o_data_row').length, 2, + "should have open a list view with 2 records in a dialog"); + + // click on a record -> should not open the record + // we don't actually check that it doesn't open the record because even + // if it tries to, it will crash as we don't define an arch in this test + $('.modal .o_list_view .o_data_row:first .o_data_cell').click(); + + form.destroy(); + }); }); }); }); -- cgit v1.2.3