diff --git a/addons/web_editor/static/src/js/backend/field_html.js b/addons/web_editor/static/src/js/backend/field_html.js index f311079f43d..16d1b602575 100644 --- a/addons/web_editor/static/src/js/backend/field_html.js +++ b/addons/web_editor/static/src/js/backend/field_html.js @@ -35,6 +35,9 @@ var FieldHtml = basic_fields.DebouncedField.extend(TranslatableFieldMixin, { className: 'oe_form_field oe_form_field_html', supportedFieldTypes: ['html'], isQuickEditable: true, + quickEditExclusion: [ + '[href]', + ], custom_events: { wysiwyg_focus: '_onWysiwygFocus', diff --git a/addons/web_editor/static/tests/field_html_tests.js b/addons/web_editor/static/tests/field_html_tests.js index 78ae590495e..bb8e509a054 100644 --- a/addons/web_editor/static/tests/field_html_tests.js +++ b/addons/web_editor/static/tests/field_html_tests.js @@ -2,6 +2,7 @@ odoo.define('web_editor.field_html_tests', function (require) { "use strict"; var ajax = require('web.ajax'); +var FormController = require('web.FormController'); var FormView = require('web.FormView'); var testUtils = require('web.test_utils'); var weTestUtils = require('web_editor.test_utils'); @@ -120,9 +121,13 @@ QUnit.module('web_editor', {}, function () { throw 'Wrong template'; }, }); + testUtils.mock.patch(FormController, { + 'multiClickTime': 0, + }); }, afterEach: function () { testUtils.mock.unpatch(ajax); + testUtils.mock.unpatch(FormController); }, }, function () { @@ -644,6 +649,34 @@ QUnit.module('web_editor', {}, function () { form.destroy(); }); + QUnit.test('Quick Edition: click on link inside html field', async function (assert) { + assert.expect(3); + + this.data['note.note'].records[0]['body'] = '
hello world
'; + + const form = await testUtils.createView({ + View: FormView, + model: 'note.note', + data: this.data, + arch: '', + res_id: 1, + }); + + assert.containsOnce(form, '.o_form_view.o_form_readonly'); + + await testUtils.dom.click(form.$('.oe_form_field[name="body"] a')); + await testUtils.nextTick(); + assert.containsOnce(form, '.o_form_view.o_form_readonly'); + + await testUtils.dom.click(form.$('.oe_form_field[name="body"] p')); + await testUtils.nextTick(); + assert.containsOnce(form, '.o_form_view.o_form_editable'); + + form.destroy(); + }); + QUnit.module('cssReadonly'); QUnit.test('rendering with iframe for readonly mode', async function (assert) {