From ddc5cc186fc6e2efa92fea6a83ad4bbed72d648c Mon Sep 17 00:00:00 2001 From: Nans Lefebvre Date: Tue, 18 Dec 2018 12:01:22 +0000 Subject: [FIX] web: call _applyX2ManyChange with the correct viewtype Have a one2many display records in a kanban subview, which opens a form view when edited. Edit a field displayed only on the form view. A call to _applyX2ManyChange is done without giving it the viewtype argument, therefore the fieldinfo is taken from the wrong view, traceback ensues. opw 1914163 closes odoo/odoo#29607 --- .../static/tests/fields/relational_fields_tests.js | 40 ++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'addons/web/static/tests/fields/relational_fields_tests.js') diff --git a/addons/web/static/tests/fields/relational_fields_tests.js b/addons/web/static/tests/fields/relational_fields_tests.js index ef15aa22df7..9cf7ebba16e 100644 --- a/addons/web/static/tests/fields/relational_fields_tests.js +++ b/addons/web/static/tests/fields/relational_fields_tests.js @@ -3357,6 +3357,46 @@ QUnit.module('relational_fields', { form.destroy(); }); + QUnit.test('widget many2many_checkboxes in a subview', function (assert) { + assert.expect(2); + + var form = createView({ + View: FormView, + model: 'partner', + data: this.data, + arch:'
' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '
', + archs: { + 'turtle,false,form': '
' + + '' + + '', + }, + res_id: 1, + }); + + form.$buttons.find('.o_form_button_edit').click(); + form.$('.o_data_cell').click(); + // edit the partner_ids field by (un)checking boxes on the widget + var $firstCheckbox = $('.modal .custom-control-input').first(); + $firstCheckbox.click(); + assert.ok($firstCheckbox.prop('checked'), "the checkbox should be ticked"); + var $secondCheckbox = $('.modal .custom-control-input').eq(1); + $secondCheckbox.click(); + assert.notOk($secondCheckbox.prop('checked'), "the checkbox should be unticked"); + form.destroy(); + }); + QUnit.test('embedded one2many with widget', function (assert) { assert.expect(1); -- cgit v1.2.3