Rodolpho Lima 69dc6d845a [FIX] mass_mailing: multiple attachments for same image
Before this commit, base64-encoded images were converted to attachments
only for the body_html field, leaving the body_arch's content unchanged.
As a result, every time a record was updated, the body_html content,
which is generated from the body_arch's content, would have the same
base64-encoded images, which were converted again to new attachments.

Moreover:
- the created attachments were not linked to the mailing record (no
  res_model and res_id).
- the attachment name contained "cropped_image", even for images that
  were not a result of cropping.
- when the image conversion happened for a record in creation, the
  resulting attachment name was "cropped_image_mailing_False_0" (or any
  other number, the relevant part is "False", where the record's id was
  expected).
- the body_arch could take an excessively large amount of space in the
  database table, due to its base64-encoded images (see [1]).

This commit makes sure the body_arch has its images converted to
attachments as well, and also makes sure such attachments are reused
when replacing the image sources in the body_html, instead of creating
new ones.

Besides, the "cropped_image_mailing" in the attachment's name was
replaced by the more generic "image_mailing".

Lastly, when a record is being created, the conversion to
attachments now happens after the call to super().create, so that the
record's id is known when creating attachments.

task-3479586

[1]: https://github.com/odoo/odoo/pull/128452

X-original-commit: 9c5a56d2be9c1a480d526755327c79e2daa90a35
Part-of: odoo/odoo#152065
2024-02-01 07:06:55 +00:00
2023-11-02 21:02:44 +00:00
…
…
…

Build Status Tech Doc Help Nightly Builds

Odoo

Odoo is a suite of web based open source business apps.

The main Odoo Apps include an Open Source CRM, Website Builder, eCommerce, Warehouse Management, Project Management, Billing & Accounting, Point of Sale, Human Resources, Marketing, Manufacturing, ...

Odoo Apps can be used as stand-alone applications, but they also integrate seamlessly so you get a full-featured Open Source ERP when you install several Apps.

Getting started with Odoo

For a standard installation please follow the Setup instructions from the documentation.

To learn the software, we recommend the Odoo eLearning, or Scale-up, the business game. Developers can start with the developer tutorials

S
Description
No description provided
Readme LGPL-3.0
3.4 GiB
Languages
Python 49.6%
JavaScript 47.8%
SCSS 2%
CSS 0.3%
HTML 0.2%