diff options
| author | Géry Debongnie <ged@odoo.com> | 2017-05-29 10:12:43 +0200 |
|---|---|---|
| committer | Géry Debongnie <ged@odoo.com> | 2017-05-29 12:12:44 +0200 |
| commit | cad943d035c200cce4a7e5a428d2883bf2452b9d (patch) | |
| tree | 3913accbc9afacc52b8fe67cc05dd24bd4faf424 /addons/web_editor/static/tests/web_editor_tests.js | |
| parent | d76dc17a980a05661c9c15c89785b7485482805d (diff) | |
[FIX] web_editor: prevent crash with FieldTextHtmlSimple
If the method commitChange from the widget FieldTextHtmlSimple was
called in mode=readonly, a traceback was displayed. This is not very
common, because most save operations are done in mode=edit, but it can
happen in readonly mode: when the user clicks on an action button, then
the form view is saved, if necessary.
To reproduce this bug, just open a form view for res.users, and click on
the Change Password button.
Diffstat (limited to 'addons/web_editor/static/tests/web_editor_tests.js')
| -rw-r--r-- | addons/web_editor/static/tests/web_editor_tests.js | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/addons/web_editor/static/tests/web_editor_tests.js b/addons/web_editor/static/tests/web_editor_tests.js index 6a18566af2b..a053ad99043 100644 --- a/addons/web_editor/static/tests/web_editor_tests.js +++ b/addons/web_editor/static/tests/web_editor_tests.js @@ -121,4 +121,31 @@ QUnit.test('field html_frame widget', function (assert) { form.destroy(); }); +QUnit.test('field htmlsimple does not crash when commitChanges is called in mode=readonly', function (assert) { + assert.expect(1); + + var form = testUtils.createView({ + View: FormView, + model: 'mass.mailing', + data: this.data, + arch: '<form string="Partners">' + + '<header>' + + '<button name="some_method" class="s" string="Do it" type="object"/>' + + '</header>' + + '<sheet>' + + '<field name="body"/>' + + '</sheet>' + + '</form>', + res_id: 1, + intercepts: { + execute_action: function () { + assert.step('execute_action'); + } + }, + }); + + form.$('button:contains(Do it)').click(); + form.destroy(); +}); + }); |
