-
-
Notifications
You must be signed in to change notification settings - Fork 618
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[16.0][IMP] mail_embed_image: improve embedding type:
- CIDs are not working in some email managers (gmail and office365) To allow this behavior we need to change the content type to multipart/related - A new option to embed images is to include the base64 content inside the src. - Then to select these options, a selected field has been added to company
- Loading branch information
1 parent
8fcc1b9
commit 44883e1
Showing
7 changed files
with
196 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
# Copyright 2019 Therp BV <https://therp.nl> | ||
# Copyright 2024 Camptocamp SA | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). | ||
from . import ir_mail_server | ||
from . import company | ||
from . import res_config_settings |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Copyright 2024 Camptocamp SA | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
from odoo import fields, models | ||
|
||
|
||
class ResCompany(models.Model): | ||
_inherit = "res.company" | ||
|
||
image_embedding_method = fields.Selection( | ||
selection=[ | ||
("none", "No attachment"), | ||
("cid", "CIDs attachment"), | ||
("data", "Data SRC"), | ||
], | ||
default="cid", # previous module version only supported CID | ||
required=True, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Copyright 2024 Camptocamp SA | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
from odoo import fields, models | ||
|
||
|
||
class ResConfigSettings(models.TransientModel): | ||
_inherit = "res.config.settings" | ||
|
||
image_embedding_method = fields.Selection( | ||
related="company_id.image_embedding_method", | ||
readonly=False, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<odoo> | ||
|
||
<record id="res_config_settings_view_form" model="ir.ui.view"> | ||
<field name="name">res.config.settings.view.form.inherit.mail</field> | ||
<field name="model">res.config.settings</field> | ||
<field name="inherit_id" ref="mail.res_config_settings_view_form" /> | ||
<field name="arch" type="xml"> | ||
<div id="companies_setting" position="inside"> | ||
<br /> | ||
<div | ||
class="o_setting_right_pane" | ||
id="mail_templates_setting" | ||
groups="mail.group_mail_template_editor,base.group_system" | ||
> | ||
<span class="o_form_label">Email Preprocessing</span> | ||
<div class="text-muted"> | ||
Method used to embed images in HTML emails. CIDs attachment does not work with all email clients. Data SRC is more reliable. | ||
</div> | ||
<field name="image_embedding_method" /> | ||
</div> | ||
</div> | ||
</field> | ||
</record> | ||
|
||
</odoo> |