diff options
| author | Nans Lefebvre <len@odoo.com> | 2018-12-18 12:01:22 +0000 |
|---|---|---|
| committer | Nans Lefebvre <len@odoo.com> | 2018-12-18 14:28:55 +0000 |
| commit | ddc5cc186fc6e2efa92fea6a83ad4bbed72d648c (patch) | |
| tree | bcb726b551e613c3ee1b53a4050eebc5f129089b /addons/web/static/tests | |
| parent | 9b6073c3ea6264f59fb11e6f797f4fff200c3d5d (diff) | |
[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
Diffstat (limited to 'addons/web/static/tests')
| -rw-r--r-- | addons/web/static/tests/fields/relational_fields_tests.js | 40 |
1 files changed, 40 insertions, 0 deletions
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:'<form string="Partners">' + + '<sheet>' + + '<notebook>' + + '<page string="Turtles">' + + '<field name="turtles" mode="tree">' + + '<tree>' + + '<field name="id"/>' + + '</tree>' + + '</field>' + + '</page>' + + '</notebook>' + + '</sheet>' + + '</form>', + archs: { + 'turtle,false,form': '<form>' + + '<field name="partner_ids" widget="many2many_checkboxes"/>' + + '</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); |
