-
-
Notifications
You must be signed in to change notification settings - Fork 637
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IMP] mail_tracking: Add option to keep aliases in mail tracking
- Loading branch information
1 parent
7f081ba
commit 1d0e8d9
Showing
8 changed files
with
90 additions
and
3 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
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
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,10 @@ | ||
from odoo import fields, models | ||
|
||
|
||
class ResCompany(models.Model): | ||
_inherit = "res.company" | ||
|
||
mail_tracking_show_aliases = fields.Boolean( | ||
string="Show Aliases in Mail Tracking", | ||
default=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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from odoo import fields, models | ||
|
||
|
||
class ResConfigSettings(models.TransientModel): | ||
_inherit = "res.config.settings" | ||
|
||
mail_tracking_show_aliases = fields.Boolean( | ||
related="company_id.mail_tracking_show_aliases", | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -161,6 +161,38 @@ def test_message_post_partner_no_email(self): | |
self.assertEqual(tracking_email.error_type, "no_recipient") | ||
self.assertFalse(self.recipient.email_bounced) | ||
|
||
def test_message_post_show_aliases(self): | ||
# Create message with show aliases setup | ||
self.env.company.mail_tracking_show_aliases = True | ||
# Setup catchall domain | ||
IrConfigParamObj = self.env["ir.config_parameter"].sudo() | ||
IrConfigParamObj.set_param("mail.catchall.domain", "test.com") | ||
# pylint: disable=C8107 | ||
message = self.env["mail.message"].create( | ||
{ | ||
"subject": "Message test", | ||
"author_id": self.sender.id, | ||
"email_from": self.sender.email, | ||
"message_type": "comment", | ||
"model": "res.partner", | ||
"res_id": self.recipient.id, | ||
"partner_ids": [(4, self.recipient.id)], | ||
"email_cc": "Dominique Pinon <[email protected]>, [email protected]", | ||
"body": "<p>This is another test message</p>", | ||
} | ||
) | ||
if message.is_thread_message(): | ||
self.env[message.model].browse(message.res_id)._notify_thread(message) | ||
message_dict, *_ = message.message_format() | ||
self.assertTrue( | ||
any( | ||
[ | ||
tracking["recipient"] == "[email protected]" | ||
for tracking in message_dict["partner_trackings"] | ||
] | ||
) | ||
) | ||
|
||
def _check_partner_trackings_cc(self, message): | ||
message_dict = message.message_format()[0] | ||
self.assertEqual(len(message_dict["partner_trackings"]), 3) | ||
|
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,25 @@ | ||
<?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.tracking</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="emails" position="inside"> | ||
<div class="col-12 col-lg-6 o_setting_box" id="mail_tracking_settings"> | ||
<div class="o_setting_left_pane"> | ||
<field name="mail_tracking_show_aliases" /> | ||
</div> | ||
<div class="o_setting_right_pane"> | ||
<div class="content-group"> | ||
<label for="mail_tracking_show_aliases" /> | ||
<div class="text-muted" id="mail_tracking_show_aliases"> | ||
Show Aliases in Mail Tracking | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</field> | ||
</record> | ||
</odoo> |