From f2f9dd3ab96c8c2542e718762180b604fd18291b Mon Sep 17 00:00:00 2001 From: trisdoan Date: Thu, 3 Oct 2024 10:03:56 +0700 Subject: [PATCH] [FW] port missing commits from 14.0 to 17.0 --- mail_tracking/models/mail_tracking_email.py | 7 +- mail_tracking/static/description/index.html | 11 ++- .../tests/test_gc_mail_tracking_email.py | 5 +- mail_tracking/tests/test_mail_tracking.py | 3 +- mail_tracking/views/res_config_settings.xml | 76 ++++++++----------- 5 files changed, 46 insertions(+), 56 deletions(-) diff --git a/mail_tracking/models/mail_tracking_email.py b/mail_tracking/models/mail_tracking_email.py index e42c4e26..cda2f335 100644 --- a/mail_tracking/models/mail_tracking_email.py +++ b/mail_tracking/models/mail_tracking_email.py @@ -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 @@ -490,7 +489,7 @@ 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 @@ -498,4 +497,4 @@ def _gc_mail_tracking_email(self, limit=5000): 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() diff --git a/mail_tracking/static/description/index.html b/mail_tracking/static/description/index.html index e1602b01..12253cdf 100644 --- a/mail_tracking/static/description/index.html +++ b/mail_tracking/static/description/index.html @@ -8,10 +8,11 @@ /* :Author: David Goodger (goodger@python.org) -: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. @@ -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 } @@ -300,7 +301,7 @@ span.pre { white-space: pre } -span.problematic { +span.problematic, pre.problematic { color: red } span.section-subtitle { @@ -495,7 +496,9 @@

Contributors

Maintainers

This module is maintained by the OCA.

-Odoo Community Association + +Odoo Community Association +

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.

diff --git a/mail_tracking/tests/test_gc_mail_tracking_email.py b/mail_tracking/tests/test_gc_mail_tracking_email.py index 57546694..74f32cef 100644 --- a/mail_tracking/tests/test_gc_mail_tracking_email.py +++ b/mail_tracking/tests/test_gc_mail_tracking_email.py @@ -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() diff --git a/mail_tracking/tests/test_mail_tracking.py b/mail_tracking/tests/test_mail_tracking.py index cb669b4e..e07a873f 100644 --- a/mail_tracking/tests/test_mail_tracking.py +++ b/mail_tracking/tests/test_mail_tracking.py @@ -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 , customer-invoices@test.com", + "email_cc": "Dominique Pinon , customer-invoices@test.com", # noqa E501 "body": "

This is another test message

", } ) - message._moderate_accept() message_dict, *_ = message.message_format() self.assertTrue( any( diff --git a/mail_tracking/views/res_config_settings.xml b/mail_tracking/views/res_config_settings.xml index be5f2fa5..cad361fd 100644 --- a/mail_tracking/views/res_config_settings.xml +++ b/mail_tracking/views/res_config_settings.xml @@ -1,47 +1,35 @@ - - res.config.settings.view.form.inherit.mail.tracking - res.config.settings - - -
-
-
- -
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
+ + res.config.settings.view.form.inherit.mail.tracking + res.config.settings + + + + + +
+
+
+ + +
+
+
+
+
+