diff options
Diffstat (limited to 'addons/web/static/tests/views/form_tests.js')
| -rw-r--r-- | addons/web/static/tests/views/form_tests.js | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/addons/web/static/tests/views/form_tests.js b/addons/web/static/tests/views/form_tests.js index 0fd60afb402..ce206777ac5 100644 --- a/addons/web/static/tests/views/form_tests.js +++ b/addons/web/static/tests/views/form_tests.js @@ -1629,6 +1629,37 @@ QUnit.module('Views', { form.destroy(); }); + QUnit.test('duplicating a record preserve the context', function (assert) { + assert.expect(2); + + var form = createView({ + View: FormView, + model: 'partner', + data: this.data, + arch: '<form string="Partners">' + + '<field name="foo"/>' + + '</form>', + res_id: 1, + viewOptions: {hasSidebar: true, context: {hey: 'hoy'}}, + mockRPC: function (route, args) { + if (args.method === 'read') { + // should have 2 read, one for initial load, second for + // read after duplicating + assert.strictEqual(args.kwargs.context.hey, 'hoy', + "should have send the correct context"); + } + if (args.method === 'search_read' && args.model === 'ir.attachment') { + return $.when([]); + } + return this._super.apply(this, arguments); + }, + }); + + form.sidebar.$('a:contains(Duplicate)').click(); + + form.destroy(); + }); + QUnit.test('cannot duplicate a record', function (assert) { assert.expect(2); |
