[FIX] web_editor: onAttachmentChange only composer

Due to a previous fix, attachments uploaded through media dialog would appear in the attachments of mail marketting.
That fix prevents attachments from 'dangling' and being garbage collected later.

That fix is now limited to the mail composer in this commit as attachments are only garbage collected for that model, for now.

related commit: c112361bf9e2f5e7b087c5e5b9a31879856b1da4

task 3003939

closes odoo/odoo#103038

X-original-commit: 69fdca133b06eb66443635bc52d380233580ef51
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
This commit is contained in:
Renaud Thiry
2022-10-11 14:10:25 +02:00
parent 52d46e1e76
commit 96c8dd3ca8
9 changed files with 30 additions and 28 deletions
@@ -2370,8 +2370,6 @@ var FieldMany2ManyBinaryMultiFiles = AbstractField.extend({
fieldsToFetch: {
name: {type: 'char'},
mimetype: {type: 'char'},
res_id: {type: 'number'},
access_token: {type: 'char'},
},
events: {
'click .o_attach': '_onAttach',
+1 -1
View File
@@ -1338,7 +1338,7 @@
<t t-name="FieldBinaryFileUploader.attachment_preview">
<t t-set="url" t-value="widget.metadata[file.id] ? widget.metadata[file.id].url : false"/>
<t t-if="file.data" t-set="file" t-value="file.data"/>
<t t-set="editable" t-value="widget.mode === 'edit' and !(file.res_id === 0 and file.access_token)"/>
<t t-set="editable" t-value="widget.mode === 'edit'"/>
<t t-if="file.mimetype" t-set="mimetype" t-value="file.mimetype"/>
<div t-attf-class="o_attachment o_attachment_many2many #{ editable ? 'o_attachment_editable' : '' } #{upload ? 'o_attachment_uploading' : ''}" t-att-title="file.name">
<div class="o_attachment_wrap">
@@ -59,8 +59,6 @@ Many2ManyBinaryField.supportedTypes = ["many2many"];
Many2ManyBinaryField.fieldsToFetch = {
name: { type: "char" },
mimetype: { type: "char" },
res_id: { type: "number" },
access_token: { type: "char" },
};
Many2ManyBinaryField.isEmpty = () => false;
@@ -25,7 +25,7 @@
</t>
<t t-name="Many2ManyBinaryField.attachment_preview" owl="1">
<t t-set="editable" t-value="!props.readonly and !(file.res_id === 0 and file.access_token)"/>
<t t-set="editable" t-value="!props.readonly"/>
<div t-attf-class="o_attachment o_attachment_many2many #{ editable ? 'o_attachment_editable' : '' } #{upload ? 'o_attachment_uploading' : ''}" t-att-title="file.name">
<div class="o_attachment_wrap">
<t t-set="ext" t-value="getExtension(file)"/>