-
- Downloads
[FIX] mail, web_editor: dialog file update event
HOW TO REPRODUCE
Go on a record (e.g. a lead), open the full composer and use the "File / Image"
button from the editor to insert an image. After sending the attachment is
displayed in chatter. However after a few days it disappears, being garbage
collected.
ISSUE
When adding an image inside a mail composer via the /image command or 'image'
button of the editor, the related attachment was never processed. This makes
sense as we do not want to attach it to the resulting message(s). However as
the attachment res_id and res_model were never updated from the compositor in
which they originated, they would become dangling attachments and be garbage
collected the next day (or the in the next pass of the GC) by
'_gc_lost_attachments'.
The attachment keeps 'mail.compose.message' as res_model and 0 as res_id.
It is therefore considered as a lost attachment and removed by the garbage
collect of attachments. As image are inlined in the content (using a link
towards /web/image) they are not part of 'attachment_ids' given to the
'message_post' method and therefore not linked to the document by
'_message_post_process_attachments' whose job is to correctly set the
model and res_id of attachments linked to the composer.
An event was not called on uploading files in a media dialog. This means the
parent of html field didn't know of the new attachments which resulted in
attachments being linked to no record at all and not being garbage collected
later. This fix makes that call.
The attachments newly uploaded in media dialog are uneditable to prevent users
from unlinking attachments that are still used in the body of the composer
(causing the same issue).
Task-2860761
closes odoo/odoo#95537
Signed-off-by:
Thibault Delavallee (tde) <tde@openerp.com>
Showing
- addons/web/static/src/js/fields/relational_fields.js 2 additions, 0 deletionsaddons/web/static/src/js/fields/relational_fields.js
- addons/web/static/src/xml/base.xml 1 addition, 1 deletionaddons/web/static/src/xml/base.xml
- addons/web/static/tests/fields/relational_fields_tests.js 4 additions, 1 deletionaddons/web/static/tests/fields/relational_fields_tests.js
- addons/web_editor/controllers/main.py 6 additions, 3 deletionsaddons/web_editor/controllers/main.py
- addons/web_editor/static/src/js/backend/field_html.js 3 additions, 3 deletionsaddons/web_editor/static/src/js/backend/field_html.js
- addons/web_editor/static/src/js/wysiwyg/widgets/media.js 2 additions, 0 deletionsaddons/web_editor/static/src/js/wysiwyg/widgets/media.js
- addons/web_editor/static/tests/field_html_tests.js 85 additions, 0 deletionsaddons/web_editor/static/tests/field_html_tests.js
Loading
Please register or sign in to comment