diff options
| author | Christophe Simonis <chs@odoo.com> | 2018-11-29 20:06:16 +0100 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2018-11-29 20:06:16 +0100 |
| commit | ce4cc24621bf6430d7d3a2d469b375b59120c200 (patch) | |
| tree | 3837b5fe41ff88b24136ab53c871bc01f965cab1 /addons/web/static/tests/views/view_dialogs_tests.js | |
| parent | 4d7aa97da38e497fef31a06543bfa5d2c8785708 (diff) | |
| parent | 82a1e1dcc33d7c123e50d3e1aacb5e127f57c521 (diff) | |
[MERGE] forward port branch 12.0 up to 82a1e1dcc33
Diffstat (limited to 'addons/web/static/tests/views/view_dialogs_tests.js')
| -rw-r--r-- | addons/web/static/tests/views/view_dialogs_tests.js | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/addons/web/static/tests/views/view_dialogs_tests.js b/addons/web/static/tests/views/view_dialogs_tests.js index 8898e520618..023a977ad56 100644 --- a/addons/web/static/tests/views/view_dialogs_tests.js +++ b/addons/web/static/tests/views/view_dialogs_tests.js @@ -478,6 +478,66 @@ QUnit.module('Views', { testUtils.mock.unpatch(ListController); parent.destroy(); }); + + QUnit.test('propagate can_create onto the search popup o2m', function (assert) { + assert.expect(3); + + this.data.instrument.records = [ + {id: 1, name: 'Tromblon1'}, + {id: 2, name: 'Tromblon2'}, + {id: 3, name: 'Tromblon3'}, + {id: 4, name: 'Tromblon4'}, + {id: 5, name: 'Tromblon5'}, + {id: 6, name: 'Tromblon6'}, + {id: 7, name: 'Tromblon7'}, + {id: 8, name: 'Tromblon8'}, + ]; + + var form = createView({ + View: FormView, + model: 'partner', + data: this.data, + arch: '<form>' + + '<field name="name"/>' + + '<field name="instrument" can_create="false"/>' + + '</form>', + res_id: 1, + archs: { + 'instrument,false,list': '<tree>'+ + '<field name="name"/>'+ + '</tree>', + 'instrument,false,search': '<search>'+ + '<field name="name"/>'+ + '</search>', + }, + viewOptions: { + mode: 'edit', + }, + + mockRPC: function(route, args) { + if (args.method === 'get_formview_id') { + return $.when(false); + } + return this._super(route, args); + }, + }); + + form.$('.o_field_widget[name="instrument"] .o_input').click(); + + assert.notOk($('.ui-autocomplete a:contains(Create and Edit)').length, + 'Create and edit not present in dropdown'); + + $('.ui-autocomplete a:contains(Search More)').trigger('mouseenter').trigger('click'); + + var $modal = $('.modal-dialog.modal-lg'); + + assert.strictEqual($modal.length, 1, 'Modal present'); + + assert.strictEqual($modal.find('.modal-footer button').text(), "Cancel", + 'Only the cancel button is present in modal'); + + form.destroy(); + }); }); }); |
