diff options
| author | Christophe Simonis <chs@odoo.com> | 2019-08-30 17:20:28 +0200 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2019-08-30 17:20:28 +0200 |
| commit | 545e6d20344f37081ccd6c6e788ea1c5383717af (patch) | |
| tree | 7786f6001919ea18792c35c4f769336ef991fd3a /addons/web/static/tests/views/form_tests.js | |
| parent | 513545cdbdf95ae61c068270ab61eec8b81c9bd8 (diff) | |
| parent | 52f6e38cea8ff9d16ab3432b3ccf032472e5a666 (diff) | |
[MERGE] forward port branch 12.0 up to 52f6e38cea8
Diffstat (limited to 'addons/web/static/tests/views/form_tests.js')
| -rw-r--r-- | addons/web/static/tests/views/form_tests.js | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/addons/web/static/tests/views/form_tests.js b/addons/web/static/tests/views/form_tests.js index 2c5eaa3e627..d89bffac31b 100644 --- a/addons/web/static/tests/views/form_tests.js +++ b/addons/web/static/tests/views/form_tests.js @@ -459,8 +459,10 @@ QUnit.module('Views', { 'The correct _view_ref should have been sent to the server, first time'); } if (args.model === 'partner_type') { - assert.deepEqual(context, {tree_view_ref: 'some_other_tree_view'}, - 'The correct _view_ref should have been sent to the server for the subview'); + assert.deepEqual(context, { + base_model_name: 'product', + tree_view_ref: 'some_other_tree_view', + }, 'The correct _view_ref should have been sent to the server for the subview'); } } return this._super.apply(this, arguments); @@ -4568,6 +4570,35 @@ QUnit.module('Views', { }); }); + QUnit.test('non inline subview and create=0 in action context', async function (assert) { + // the create=0 should apply on the main view (form), but not on subviews + assert.expect(2); + + const form = await createView({ + View: FormView, + model: 'partner', + data: this.data, + arch: '<form><field name="product_ids" mode="kanban"/></form>', + archs: { + "product,false,kanban": `<kanban> + <templates><t t-name="kanban-box"> + <div><field name="name"/></div> + </t></templates> + </kanban>`, + }, + res_id: 1, + viewOptions: { + context: {create: false}, + mode: 'edit', + }, + }); + + assert.containsNone(form, '.o_form_button_create'); + assert.containsOnce(form, '.o-kanban-button-new'); + + form.destroy(); + }); + QUnit.test('readonly fields with modifiers may be saved', async function (assert) { // the readonly property on the field description only applies on view, // this is not a DB constraint. It should be seen as a default value, |
