diff options
| author | Aaron Bohy <aab@odoo.com> | 2019-08-16 11:08:00 +0000 |
|---|---|---|
| committer | Aaron Bohy <aab@odoo.com> | 2019-08-23 06:28:35 +0000 |
| commit | dddaff8418c137a6c68e695ce7a971a2b02b9a1c (patch) | |
| tree | a64d0077186f17fb57f0c5faa2c5c7ef66cbcf65 /addons/web/static/tests/fields/relational_fields | |
| parent | 1824020cc274f3ef6e86fec5248d49ffde86e480 (diff) | |
[IMP] web: list: keep widths when removing last record
When there were records in the list (and the browser computed the
optimal column widths according to them), and the user removes
them, we want to keep the widths as they are instead of forcing
them according to the field's types.
Diffstat (limited to 'addons/web/static/tests/fields/relational_fields')
| -rw-r--r-- | addons/web/static/tests/fields/relational_fields/field_one2many_tests.js | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/addons/web/static/tests/fields/relational_fields/field_one2many_tests.js b/addons/web/static/tests/fields/relational_fields/field_one2many_tests.js index e8d8785b77a..19883a53c73 100644 --- a/addons/web/static/tests/fields/relational_fields/field_one2many_tests.js +++ b/addons/web/static/tests/fields/relational_fields/field_one2many_tests.js @@ -8606,6 +8606,38 @@ QUnit.module('fields', {}, function () { form.destroy(); }); + + QUnit.test('column widths are kept when remove last record in o2m', async function (assert) { + assert.expect(1); + + this.data.partner.records[0].p = [2]; + + var form = await createView({ + View: FormView, + model: 'partner', + data: this.data, + arch: '<form>' + + '<field name="p">' + + '<tree editable="top">' + + '<field name="date"/>' + + '<field name="foo"/>' + + '</tree>' + + '</field>' + + '</form>', + res_id: 1, + viewOptions: { + mode: 'edit', + }, + }); + + var width = form.$('th[data-name="date"]')[0].offsetWidth; + + await testUtils.dom.click(form.$('.o_data_row .o_list_record_remove')); + + assert.strictEqual(form.$('th[data-name="date"]')[0].offsetWidth, width); + + form.destroy(); + }); }); }); }); |
