diff options
| author | Christophe Simonis <chs@odoo.com> | 2018-06-06 10:47:53 +0200 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2018-06-06 10:47:53 +0200 |
| commit | 116826e02d655bdfef5d208a075acbaf56f1dcb8 (patch) | |
| tree | 74c68a7f247b4b08fe366d91e8f8cba2f0760520 /addons/web/static/tests/fields/relational_fields_tests.js | |
| parent | 120c93acbe3b8edf8496cd559edb8ae26943f79f (diff) | |
| parent | e7aff3775fbc9559765601cb7b7a0a3b7f06d7ed (diff) | |
[MERGE] forward port branch 11.0 up to e7aff3775fb
Diffstat (limited to 'addons/web/static/tests/fields/relational_fields_tests.js')
| -rw-r--r-- | addons/web/static/tests/fields/relational_fields_tests.js | 52 |
1 files changed, 52 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 6db8f370f2b..517c1094703 100644 --- a/addons/web/static/tests/fields/relational_fields_tests.js +++ b/addons/web/static/tests/fields/relational_fields_tests.js @@ -2551,6 +2551,58 @@ QUnit.module('relational_fields', { QUnit.module('FieldOne2Many'); + QUnit.test('New record with a o2m also with 2 new records, ordered, and resequenced', function (assert) { + assert.expect(3); + + // Needed to have two new records in a single stroke + this.data.partner.onchanges = { + foo: function(obj) { + obj.p = [ + [5], + [0, 0, {trululu: false}], + [0, 0, {trululu: false}], + ] + } + }; + + var form = createView({ + View: FormView, + model: 'partner', + data: this.data, + arch:'<form string="Partners">' + + '<field name="foo" />' + + '<field name="p">' + + '<tree editable="bottom" default_order="int_field">' + + '<field name="int_field" widget="handle"/>' + + '<field name="trululu"/>' + + '</tree>' + + '</field>' + + '</form>', + viewOptions: { + mode: 'create', + }, + mockRPC: function (route, args) { + assert.step(args.method + ' ' + args.model) + return this._super(route, args); + }, + }); + + // change the int_field through drag and drop + // that way, we'll trigger the sorting and the name_get + // of the lines of "p" + testUtils.dragAndDrop( + form.$('.ui-sortable-handle').eq(1), + form.$('tbody tr').first(), + {position: 'top'} + ); + + // Only those two should have been called + // name_get on trululu would trigger an traceback + assert.verifySteps(['default_get partner', 'onchange partner']); + + form.destroy(); + }); + QUnit.test('O2M List with pager, decoration and default_order: add and cancel adding', function (assert) { assert.expect(3); |
