Skip to content

Commit

Permalink
[FW] port missing commits from 14.0 to 17.0
Browse files Browse the repository at this point in the history
  • Loading branch information
trisdoan committed Nov 5, 2024
1 parent d6982d7 commit f2f9dd3
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 56 deletions.
7 changes: 3 additions & 4 deletions mail_tracking/models/mail_tracking_email.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,7 @@ class MailTrackingEmail(models.Model):
@api.depends("mail_message_id")
def _compute_message_id(self):
"""This helper field will allow us to map the message_id from either the linked
mail.message or a mass.mailing mail.trace.
"""
mail.message or a mass.mailing mail.trace."""
self.message_id = False
for tracking in self.filtered("mail_message_id"):
tracking.message_id = tracking.mail_message_id.message_id
Expand Down Expand Up @@ -490,12 +489,12 @@ def _gc_mail_tracking_email(self, limit=5000):
_logger.info(
"Deleting %s mail.tracking.email records", len(records_to_delete)
)
self.flush()
records_to_delete.flush_recordset()
# Using a direct query to avoid ORM as it causes an issue with
# a related field mass_mailing_id in customer DB when deleting
# the records. This might be 14.0 specific, so changing to
# .unlink() should be tested when forward porting.
query = "DELETE FROM mail_tracking_email WHERE id IN %s"
args = (tuple(records_to_delete.ids),)
self.env.cr.execute(query, args)
self.invalidate_cache()
self.invalidate_model()
11 changes: 7 additions & 4 deletions mail_tracking/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@

/*
:Author: David Goodger ([email protected])
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
:Copyright: This stylesheet has been placed in the public domain.

Default cascading style sheet for the HTML output of Docutils.
Despite the name, some widely supported CSS2 features are used.

See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
customize this style sheet.
Expand Down Expand Up @@ -274,7 +275,7 @@
margin-left: 2em ;
margin-right: 2em }

pre.code .ln { color: grey; } /* line numbers */
pre.code .ln { color: gray; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
Expand All @@ -300,7 +301,7 @@
span.pre {
white-space: pre }

span.problematic {
span.problematic, pre.problematic {
color: red }

span.section-subtitle {
Expand Down Expand Up @@ -495,7 +496,9 @@ <h2><a class="toc-backref" href="#toc-entry-8">Contributors</a></h2>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#toc-entry-9">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
<a class="reference external image-reference" href="https://odoo-community.org">
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
</a>
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.</p>
Expand Down
5 changes: 3 additions & 2 deletions mail_tracking/tests/test_gc_mail_tracking_email.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)

from odoo import fields
from odoo.tests.common import SavepointCase

from odoo.addons.base.tests.common import SavepointCaseWithUserDemo

class TestMailTrackingEmailCleanUp(SavepointCase):

class TestMailTrackingEmailCleanUp(SavepointCaseWithUserDemo):
@classmethod
def setUpClass(cls):
super().setUpClass()
Expand Down
3 changes: 1 addition & 2 deletions mail_tracking/tests/test_mail_tracking.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,11 +174,10 @@ def test_message_post_show_aliases(self):
"model": "res.partner",
"res_id": self.recipient.id,
"partner_ids": [(4, self.recipient.id)],
"email_cc": "Dominique Pinon <[email protected]>, [email protected]",
"email_cc": "Dominique Pinon <[email protected]>, [email protected]", # noqa E501
"body": "<p>This is another test message</p>",
}
)
message._moderate_accept()
message_dict, *_ = message.message_format()
self.assertTrue(
any(
Expand Down
76 changes: 32 additions & 44 deletions mail_tracking/views/res_config_settings.xml
Original file line number Diff line number Diff line change
@@ -1,47 +1,35 @@
<?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
class="col-12 col-lg-6 o_setting_box"
id="mail_tracking_deletion_job_settings"
>
<div class="o_setting_left_pane">
<field name="mail_tracking_email_max_age_days" />
</div>
<div class="o_setting_right_pane">
<div class="content-group">
<label
for="mail_tracking_email_max_age_days"
string="Max age in days of mail tracking email records"
/>
<div
class="text-muted"
id="mail_tracking_email_max_age_days"
>
If set as positive integer enables the deletion of old mail tracking records to reduce the database size.
</div>
</div>
</div>
</div>
</div>
</field>
</record>
<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">
<xpath expr="//block[@id='emails']" position="inside">
<setting>
<field name="mail_tracking_show_aliases" />
<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>
</setting>
<setting>
<field name="mail_tracking_email_max_age_days" />
<div class="content-group">
<label
for="mail_tracking_email_max_age_days"
string="Max age in days of mail tracking email records"
/>
<div
class="text-muted"
id="mail_tracking_email_max_age_days"
>If set as positive integer enables the deletion of old mail tracking records to reduce the database size.</div>
</div>
</setting>
</xpath>
</field>
</record>
</odoo>

0 comments on commit f2f9dd3

Please sign in to comment.