diff options
| author | Aaron Bohy <aab@odoo.com> | 2019-08-23 08:40:16 +0000 |
|---|---|---|
| committer | Aaron Bohy <aab@odoo.com> | 2019-08-23 11:08:27 +0000 |
| commit | 6602e1cf2dccbd0cbdcdf3e5e4547dbc6f0c5b6d (patch) | |
| tree | 412275b83a7b71d4ba351c92f6b31ebb3f766b07 /addons/web/static/tests | |
| parent | edc710f75898bd3a4a795432ce387153f2730894 (diff) | |
[FIX] web: grouped list with <groupby> node and onchange
Let's assume an editable grouped list view with a <groupby>
node containing subfields, and an onchange. Edit a row to trigger
the onchange. Before this rev., it crashed because the onchange
specs was incorrect: it followed the relation of the many2one
and thus included its subfields (whereas it should only follow the
relation for x2many fields).
For example, go to Accounting > Accounting > Sales and edit the
label of a move line.
Task 2044187
closes odoo/odoo#36001
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
Diffstat (limited to 'addons/web/static/tests')
| -rw-r--r-- | addons/web/static/tests/views/list_tests.js | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/addons/web/static/tests/views/list_tests.js b/addons/web/static/tests/views/list_tests.js index 66be047c984..02c46066c5e 100644 --- a/addons/web/static/tests/views/list_tests.js +++ b/addons/web/static/tests/views/list_tests.js @@ -2251,6 +2251,42 @@ QUnit.module('Views', { list.destroy(); }); + QUnit.test('groupby node with subfields, and onchange', async function (assert) { + assert.expect(1); + + this.data.foo.onchanges = { + foo: function () {}, + }; + + const list = await createView({ + View: ListView, + model: 'foo', + data: this.data, + arch: `<tree editable="bottom" expand="1"> + <field name="foo"/> + <field name="currency_id"/> + <groupby name="currency_id"> + <field name="position" invisible="1"/> + </groupby> + </tree>`, + groupBy: ['currency_id'], + mockRPC: function (route, args) { + if (args.method === 'onchange') { + assert.deepEqual(args.args[3], { + foo: "1", + currency_id: "", + }, 'onchange spec should not follow relation of many2one fields'); + } + return this._super.apply(this, arguments); + }, + }); + + await testUtils.dom.click(list.$('.o_data_row:first .o_data_cell:first')); + await testUtils.fields.editInput(list.$('.o_field_widget[name=foo]'), "new value"); + + list.destroy(); + }); + QUnit.test('list view, editable, without data', async function (assert) { assert.expect(12); |
