diff --git a/addons/web/static/tests/legacy/fields/relational_fields_tests.js b/addons/web/static/tests/legacy/fields/relational_fields_tests.js
index c98ea14e015..2ae838787dc 100644
--- a/addons/web/static/tests/legacy/fields/relational_fields_tests.js
+++ b/addons/web/static/tests/legacy/fields/relational_fields_tests.js
@@ -2977,14 +2977,11 @@ QUnit.module('Legacy relational_fields', {
fields: {
name: {string:"Name", type: "char"},
mimetype: {string: "Mimetype", type: "char"},
- res_id: {type: "number"},
- access_token: {type: "char"}
},
records: [{
id: 17,
name: 'Marley&Me.jpg',
mimetype: 'jpg',
- res_id: 1, //non-zero to avoid transiant model editor attachment protection
}],
};
this.data.turtle.fields.picture_ids = {
@@ -3008,7 +3005,7 @@ QUnit.module('Legacy relational_fields', {
mockRPC: function (route, args) {
assert.step(route);
if (route === '/web/dataset/call_kw/ir.attachment/read') {
- assert.deepEqual(args.args[1], ['name', 'mimetype', 'res_id', 'access_token']);
+ assert.deepEqual(args.args[1], ['name', 'mimetype']);
}
return this._super.apply(this, arguments);
},
diff --git a/addons/web/static/tests/views/fields/many2many_binary_field_tests.js b/addons/web/static/tests/views/fields/many2many_binary_field_tests.js
index cf80b3fcd33..796327e478b 100644
--- a/addons/web/static/tests/views/fields/many2many_binary_field_tests.js
+++ b/addons/web/static/tests/views/fields/many2many_binary_field_tests.js
@@ -96,7 +96,7 @@ QUnit.module("Fields", (hooks) => {
assert.step(route);
}
if (route === "/web/dataset/call_kw/ir.attachment/read") {
- assert.deepEqual(args.args[1], ["name", "mimetype", "res_id", "access_token"]);
+ assert.deepEqual(args.args[1], ["name", "mimetype"]);
}
},
});
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 0a4db994d95..8a9b043dfd6 100644
--- a/addons/web_editor/static/src/js/backend/field_html.js
+++ b/addons/web_editor/static/src/js/backend/field_html.js
@@ -334,10 +334,11 @@ var FieldHtml = basic_fields.DebouncedField.extend(DynamicPlaceholderFieldMixin)
* @param {Object} event the event containing attachment data
*/
_onAttachmentChange: function (event) {
- const attachments = event.data;
- if (!this.fieldNameAttachment) {
+ // This only needs to happen for the composer for now
+ if (!this.fieldNameAttachment || this.model !== 'mail.compose.message') {
return;
}
+ const attachments = event.data;
this.trigger_up('field_changed', {
dataPointID: this.dataPointID,
changes: _.object([this.fieldNameAttachment], [{
diff --git a/addons/web_editor/static/src/js/backend/html_field.js b/addons/web_editor/static/src/js/backend/html_field.js
index a8f76e08830..6e3b7b75608 100644
--- a/addons/web_editor/static/src/js/backend/html_field.js
+++ b/addons/web_editor/static/src/js/backend/html_field.js
@@ -497,7 +497,8 @@ export class HtmlField extends Component {
return getWysiwygClass();
}
_onAttachmentChange(attachment) {
- if (!this.props.record.fieldNames.includes('attachment_ids')) {
+ // This only needs to happen for the composer for now
+ if (!(this.props.record.fieldNames.includes('attachment_ids') && this.props.record.resModel === 'mail.compose.message')) {
return;
}
this.props.record.update(_.object(['attachment_ids'], [{