diff options
| author | Christophe Simonis <chs@odoo.com> | 2017-11-16 12:40:36 +0100 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2017-11-16 12:40:36 +0100 |
| commit | a094f6318b556298ab73df7910a70bc2a6f6a54e (patch) | |
| tree | 0c9282cf8c92ed72ca8514a1c650e7966ed54b59 /addons/web/static/tests/fields/relational_fields_tests.js | |
| parent | 6e8faf40bd1f63b8001aad11bca9ff749ca365c8 (diff) | |
| parent | 745d00362ab8353bf88457b05f090c470f780ef5 (diff) | |
[MERGE] forward port branch saas-16 up to 745d00362ab
Diffstat (limited to 'addons/web/static/tests/fields/relational_fields_tests.js')
| -rw-r--r-- | addons/web/static/tests/fields/relational_fields_tests.js | 59 |
1 files changed, 59 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 2e8499b31e1..aa8fa8e4d0c 100644 --- a/addons/web/static/tests/fields/relational_fields_tests.js +++ b/addons/web/static/tests/fields/relational_fields_tests.js @@ -5521,6 +5521,65 @@ QUnit.module('relational_fields', { form.destroy(); }); + QUnit.test('many2many list in a one2many opened by a many2one', function (assert) { + assert.expect(1); + + this.data.turtle.records[1].turtle_trululu = 2; + var form = createView({ + View: FormView, + model: 'partner', + data: this.data, + arch: '<form string="Partners">' + + '<field name="turtles">' + + '<tree editable="bottom">' + + '<field name="turtle_trululu"/>' + + '</tree>' + + '</field>' + + '</form>', + res_id: 1, + archs: { + "partner,false,form": '<form string="P">' + + '<field name="timmy"/>' + + '</form>', + "partner_type,false,list": '<tree editable="bottom">' + + '<field name="display_name"/>' + + '</tree>', + "partner_type,false,search": '<search>' + + '</search>', + }, + viewOptions: { + mode: 'edit', + }, + mockRPC: function (route, args) { + if (route === '/web/dataset/call_kw/partner/get_formview_id') { + return $.when(false); + } + if (args.method === 'write') { + assert.deepEqual(args.args[1].timmy, [[6, false, [12]]], + 'should properly write ids') + } + return this._super.apply(this, arguments); + }, + }); + + // edit the first partner in the one2many partner form view + form.$('.o_data_row:first td.o_data_cell').click(); + // open form view for many2one + form.$('.o_external_button').click(); + + // click on add, to add a new partner in the m2m + $('.modal .o_field_x2many_list_row_add a').click(); + + // select the partner_type 'gold' (this closes the 2nd modal) + $('.modal td:contains(gold)').click(); + + // confirm the changes in the modal + $('.modal .modal-footer .btn-primary').click(); + + form.$buttons.find('.o_form_button_save').click(); + form.destroy(); + }); + QUnit.test('one2many (who contains display_name) with tree view and without form view', function (assert) { assert.expect(1); |
