diff --git a/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js b/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js index 778cb91bcde96ce4e6250ac87bbf7d33b171fcad..c78256acca0d5329c4f9644b554f9b1c6b0a5bb8 100644 --- a/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js +++ b/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js @@ -856,7 +856,10 @@ const Wysiwyg = Widget.extend({ */ saveModifiedImages: function ($editable = this.$editable) { const defs = _.map($editable, async editableEl => { - const {oeModel: resModel, oeId: resId} = editableEl.dataset; + let { oeModel: resModel, oeId: resId } = editableEl.dataset; + if (!resModel) { + ({ res_model: resModel, res_id: resId } = this.options.recordInfo); + } const proms = [...editableEl.querySelectorAll('.o_modified_image_to_save')].map(async el => { const isBackground = !el.matches('img'); const dirtyEditable = el.closest(".o_dirty"); diff --git a/addons/web_editor/static/tests/html_field_tests.js b/addons/web_editor/static/tests/html_field_tests.js index e7c17e860ef2bbfc7429d61498feac1d8cfc47c3..2683da5d3c56321165d21d00ad085e0badd50b55 100644 --- a/addons/web_editor/static/tests/html_field_tests.js +++ b/addons/web_editor/static/tests/html_field_tests.js @@ -295,7 +295,7 @@ QUnit.module("WebEditor.HtmlField", ({ beforeEach }) => { QUnit.module('Save scenarios'); QUnit.test("Ensure that urgentSave works even with modified image to save", async (assert) => { - assert.expect(3); + assert.expect(5); let formController; // Patch to get the controller instance. patchWithCleanup(FormController.prototype, { @@ -379,6 +379,8 @@ QUnit.module("WebEditor.HtmlField", ({ beforeEach }) => { route === `/web_editor/modify_image/${imageRecord.id}` ) { if (modifyImageCount === 0) { + assert.equal(args.res_model, 'partner'); + assert.equal(args.res_id, 1); await modifyImagePromise; return newImageSrc; } else {