diff options
| author | Aaron Bohy <aab@odoo.com> | 2018-02-15 10:14:15 +0100 |
|---|---|---|
| committer | Aaron Bohy <aab@odoo.com> | 2018-02-16 14:28:50 +0100 |
| commit | ff019aa52f4857b45ebad301757970d99df37aee (patch) | |
| tree | 409a4b1fbc24925c490412f87cc738a0cf2daa1e /addons/web/static/tests/fields | |
| parent | cf03101447cf572417274f06f232056d6b944237 (diff) | |
[FIX] web: BasicModel: onchange on X2M: handle command 6
Before this rev., when an onchange returned a command 6 for an
x2many field, it was completely ignored by the BasicModel.
Diffstat (limited to 'addons/web/static/tests/fields')
| -rw-r--r-- | addons/web/static/tests/fields/relational_fields_tests.js | 39 |
1 files changed, 39 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 e928d4b9f2c..4f7041ad2d5 100644 --- a/addons/web/static/tests/fields/relational_fields_tests.js +++ b/addons/web/static/tests/fields/relational_fields_tests.js @@ -2906,6 +2906,45 @@ QUnit.module('relational_fields', { form.destroy(); }); + QUnit.test('onchange returning a command 6 for an x2many', function (assert) { + assert.expect(2); + + this.data.partner.onchanges = { + foo: function (obj) { + obj.turtles = [[6, false, [1, 2, 3]]]; + }, + }; + + var form = createView({ + View: FormView, + model: 'partner', + data: this.data, + arch:'<form>' + + '<field name="foo"/>' + + '<field name="turtles">' + + '<tree>' + + '<field name="turtle_foo"/>' + + '</tree>' + + '</field>' + + '</form>', + res_id: 1, + viewOptions: { + mode: 'edit', + }, + }); + + assert.strictEqual(form.$('.o_data_row').length, 1, + "there should be one record in the relation"); + + // change the value of foo to trigger the onchange + form.$('.o_field_widget[name=foo]').val('some value').trigger('input'); + + assert.strictEqual(form.$('.o_data_row').length, 3, + "there should be three records in the relation"); + + form.destroy(); + }); + QUnit.test('x2many fields inside x2manys are fetched after an onchange', function (assert) { assert.expect(6); |
