diff options
| author | Géry Debongnie <ged@odoo.com> | 2017-10-19 10:08:38 +0200 |
|---|---|---|
| committer | Géry Debongnie <ged@odoo.com> | 2017-10-19 10:56:49 +0200 |
| commit | d8f03e64fd46f45446c69f6b851813c559d0d5c7 (patch) | |
| tree | c6c2f52aa563853281f74f9971d4a72468566eb6 /addons/web/static/tests/fields/relational_fields_tests.js | |
| parent | 841f41f95b7cf7d8f13ddce724d60d1d1149886d (diff) | |
[FIX] web: do not send id in update commands for m2m
When we generate commands for many2many, it could happen that the id was
in the list of changed fields (when we are in a new records, with a non
empty initial onchange). When this happens, the server is not happy.
To reproduce this, open the uninstall wizard of a module in the 'App'
application. This creates a new record with a non-empty many2many
field. Then click on 'Show technical modules', this will trigger an
onchange which should not send the id field.
Diffstat (limited to 'addons/web/static/tests/fields/relational_fields_tests.js')
| -rw-r--r-- | addons/web/static/tests/fields/relational_fields_tests.js | 36 |
1 files changed, 36 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 5677443aa0f..b116f10de86 100644 --- a/addons/web/static/tests/fields/relational_fields_tests.js +++ b/addons/web/static/tests/fields/relational_fields_tests.js @@ -6633,6 +6633,42 @@ QUnit.module('relational_fields', { form.destroy(); }); + QUnit.test('default_get, onchange, onchange on m2m', function (assert) { + assert.expect(1); + + this.data.partner.onchanges.int_field = function (obj) { + if (obj.int_field === 2) { + assert.deepEqual(obj.timmy, [ + [6, false, [12]], + [1, 12, {display_name: 'gold'}] + ]); + } + obj.timmy = [ + [5], + [1, 12, {display_name: 'gold'}] + ]; + }; + + var form = createView({ + View: FormView, + model: 'partner', + data: this.data, + arch: '<form>' + + '<sheet>' + + '<field name="timmy">' + + '<tree>' + + '<field name="display_name"/>' + + '</tree>' + + '</field>' + + '<field name="int_field"/>' + + '</sheet>' + + '</form>', + }); + + form.$('.o_field_widget[name=int_field]').val(2).trigger('input'); + form.destroy(); + }); + QUnit.module('FieldStatus'); QUnit.test('static statusbar widget on many2one field', function (assert) { |
