From 3dd97db07fcf22bf1dd7fcaa912a20438483bc7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9ry=20Debongnie?= Date: Thu, 18 May 2017 10:45:36 +0200 Subject: [FIX] web: properly loads default values for many2manys Many2many default value can be a list of ids, and in that case, we did not properly load data. It could be seen by selecting a few contacts (in list view), then opening the 'Merge contact' wizard in the sidebar (action menu). Before this commit, the wizard did show a list with some empty rows (for the field partner_ids). --- .../static/tests/fields/relational_fields_tests.js | 25 ++++++++++++++++++++++ 1 file changed, 25 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 44b41219d52..2c6d35bc915 100644 --- a/addons/web/static/tests/fields/relational_fields_tests.js +++ b/addons/web/static/tests/fields/relational_fields_tests.js @@ -3579,6 +3579,31 @@ QUnit.module('relational_fields', { form.destroy(); }); + QUnit.test('many2many list: list of id as default value', function (assert) { + assert.expect(1); + + this.data.partner.fields.turtles.default = [2, 3]; + this.data.partner.fields.turtles.type = "many2many"; + + var form = createView({ + View: FormView, + model: 'partner', + data: this.data, + arch:'
' + + '' + + '' + + '' + + '' + + '' + + '
', + }); + + assert.strictEqual(form.$('td.o_data_cell').text(), "blipkawa", + "should have loaded default data"); + + form.destroy(); + }); + QUnit.test('many2many list with x2many: add a record', function (assert) { assert.expect(18); -- cgit v1.2.3