From 08f1fa11a9bd0ef8956e364fb5346d3844aabef1 Mon Sep 17 00:00:00 2001 From: Kevin Khao Date: Fri, 15 Jan 2021 17:07:25 +0100 Subject: [PATCH 1/7] [14.0][ADD] mail_partial_autodelete --- mail_partial_autodelete/README.rst | 1 + mail_partial_autodelete/__init__.py | 1 + mail_partial_autodelete/__manifest__.py | 14 +++++++++++ mail_partial_autodelete/models/__init__.py | 1 + mail_partial_autodelete/models/mail_mail.py | 20 ++++++++++++++++ .../readme/CONTRIBUTORS.rst | 2 ++ .../readme/DESCRIPTION.rst | 4 ++++ mail_partial_autodelete/readme/USAGE.rst | 1 + mail_partial_autodelete/tests/__init__.py | 1 + .../tests/test_mail_partial_autodelete.py | 24 +++++++++++++++++++ 10 files changed, 69 insertions(+) create mode 100644 mail_partial_autodelete/README.rst create mode 100644 mail_partial_autodelete/__init__.py create mode 100644 mail_partial_autodelete/__manifest__.py create mode 100644 mail_partial_autodelete/models/__init__.py create mode 100644 mail_partial_autodelete/models/mail_mail.py create mode 100644 mail_partial_autodelete/readme/CONTRIBUTORS.rst create mode 100644 mail_partial_autodelete/readme/DESCRIPTION.rst create mode 100644 mail_partial_autodelete/readme/USAGE.rst create mode 100644 mail_partial_autodelete/tests/__init__.py create mode 100644 mail_partial_autodelete/tests/test_mail_partial_autodelete.py diff --git a/mail_partial_autodelete/README.rst b/mail_partial_autodelete/README.rst new file mode 100644 index 0000000000..258cd5725d --- /dev/null +++ b/mail_partial_autodelete/README.rst @@ -0,0 +1 @@ +todo diff --git a/mail_partial_autodelete/__init__.py b/mail_partial_autodelete/__init__.py new file mode 100644 index 0000000000..0650744f6b --- /dev/null +++ b/mail_partial_autodelete/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/mail_partial_autodelete/__manifest__.py b/mail_partial_autodelete/__manifest__.py new file mode 100644 index 0000000000..00a8bcfb43 --- /dev/null +++ b/mail_partial_autodelete/__manifest__.py @@ -0,0 +1,14 @@ +# Copyright 2020 Akretion (http://www.akretion.com) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). +{ + "name": "Mail partial autodelete", + "version": "14.0.1.0.0", + "category": "Generic Modules", + "summary": """ Add functionality to automatically purge body of emails """, + "author": "Akretion,Odoo Community Association (OCA)", + "website": "https://github.com/OCA/social", + "depends": ["mail"], + "license": "AGPL-3", + "data": [], + "installable": True, +} diff --git a/mail_partial_autodelete/models/__init__.py b/mail_partial_autodelete/models/__init__.py new file mode 100644 index 0000000000..08a6892ca3 --- /dev/null +++ b/mail_partial_autodelete/models/__init__.py @@ -0,0 +1 @@ +from . import mail_mail diff --git a/mail_partial_autodelete/models/mail_mail.py b/mail_partial_autodelete/models/mail_mail.py new file mode 100644 index 0000000000..fe78bba21b --- /dev/null +++ b/mail_partial_autodelete/models/mail_mail.py @@ -0,0 +1,20 @@ +# Copyright 2021 Akretion (http://www.akretion.com) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from odoo import models + + +class MailMail(models.Model): + _inherit = "mail.mail" + + def _send(self, auto_commit=False, raise_exception=False, smtp_session=None): + self = self.with_context(autodelete_skip_unlink=True) + super()._send(auto_commit, raise_exception, smtp_session) + + def unlink(self): + to_unlink = self + if self.env.context.get("autodelete_skip_unlink"): + to_purge = self.filtered(lambda r: r.auto_delete) + to_purge.write({"body_html": "", "body": ""}) + to_unlink -= to_purge + super(MailMail, to_unlink).unlink() diff --git a/mail_partial_autodelete/readme/CONTRIBUTORS.rst b/mail_partial_autodelete/readme/CONTRIBUTORS.rst new file mode 100644 index 0000000000..79f515ed4a --- /dev/null +++ b/mail_partial_autodelete/readme/CONTRIBUTORS.rst @@ -0,0 +1,2 @@ +* Kevin Khao +* Sébastien Beau diff --git a/mail_partial_autodelete/readme/DESCRIPTION.rst b/mail_partial_autodelete/readme/DESCRIPTION.rst new file mode 100644 index 0000000000..f839d17ea8 --- /dev/null +++ b/mail_partial_autodelete/readme/DESCRIPTION.rst @@ -0,0 +1,4 @@ +This module changes what the "autodelete" flag on emails does. These emails' content is purged, it will not delete them +after sending them. +Useful in case you want to keep track of what was sent, but don't want to store sensitive content that was in the +mail body. diff --git a/mail_partial_autodelete/readme/USAGE.rst b/mail_partial_autodelete/readme/USAGE.rst new file mode 100644 index 0000000000..855c6630fb --- /dev/null +++ b/mail_partial_autodelete/readme/USAGE.rst @@ -0,0 +1 @@ +Just install this module and if needed put context key force_autodelete for emails you don't care about. diff --git a/mail_partial_autodelete/tests/__init__.py b/mail_partial_autodelete/tests/__init__.py new file mode 100644 index 0000000000..0a8a69c1ff --- /dev/null +++ b/mail_partial_autodelete/tests/__init__.py @@ -0,0 +1 @@ +from . import test_mail_partial_autodelete diff --git a/mail_partial_autodelete/tests/test_mail_partial_autodelete.py b/mail_partial_autodelete/tests/test_mail_partial_autodelete.py new file mode 100644 index 0000000000..a79293deb1 --- /dev/null +++ b/mail_partial_autodelete/tests/test_mail_partial_autodelete.py @@ -0,0 +1,24 @@ +# Copyright 2021 Akretion (http://www.akretion.com) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from odoo.tests import SavepointCase + + +class TestMailPartialAutodeleteCase(SavepointCase): + def setUp(self): + super().setUp() + self.mail = self.env["mail.mail"].create( + { + "body": "example body", + } + ) + + def test_no_autodelete(self): + self.mail.auto_delete = False + self.mail._send() + self.assertEqual(self.mail.body, "

example body

") + + def test_autodelete_only_purge(self): + self.mail.auto_delete = True + self.mail._send() + self.assertEqual(self.mail.body, "") From f10d714c69cd98dff44e3358ed87b459a0072a80 Mon Sep 17 00:00:00 2001 From: Kevin Khao Date: Tue, 26 Jan 2021 09:26:09 +0100 Subject: [PATCH 2/7] Update mail_partial_autodelete/models/mail_mail.py Co-authored-by: beau sebastien --- mail_partial_autodelete/models/mail_mail.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mail_partial_autodelete/models/mail_mail.py b/mail_partial_autodelete/models/mail_mail.py index fe78bba21b..598c35e454 100644 --- a/mail_partial_autodelete/models/mail_mail.py +++ b/mail_partial_autodelete/models/mail_mail.py @@ -9,7 +9,7 @@ class MailMail(models.Model): def _send(self, auto_commit=False, raise_exception=False, smtp_session=None): self = self.with_context(autodelete_skip_unlink=True) - super()._send(auto_commit, raise_exception, smtp_session) + return super()._send(auto_commit, raise_exception, smtp_session) def unlink(self): to_unlink = self From 786e6094af43e0d67e0d514c351c16d519670c2b Mon Sep 17 00:00:00 2001 From: Kevin Khao Date: Tue, 26 Jan 2021 09:26:21 +0100 Subject: [PATCH 3/7] Update mail_partial_autodelete/models/mail_mail.py Co-authored-by: beau sebastien --- mail_partial_autodelete/models/mail_mail.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/mail_partial_autodelete/models/mail_mail.py b/mail_partial_autodelete/models/mail_mail.py index 598c35e454..fca1523943 100644 --- a/mail_partial_autodelete/models/mail_mail.py +++ b/mail_partial_autodelete/models/mail_mail.py @@ -12,9 +12,7 @@ def _send(self, auto_commit=False, raise_exception=False, smtp_session=None): return super()._send(auto_commit, raise_exception, smtp_session) def unlink(self): - to_unlink = self if self.env.context.get("autodelete_skip_unlink"): - to_purge = self.filtered(lambda r: r.auto_delete) - to_purge.write({"body_html": "", "body": ""}) - to_unlink -= to_purge - super(MailMail, to_unlink).unlink() + return self.write({"body_html": "", "body": ""}) + else: + return super().unlink() From 0140161934f7f8ca952cdda6b7058bfd4dd58f21 Mon Sep 17 00:00:00 2001 From: Kevin Khao Date: Mon, 27 Dec 2021 11:32:21 +0300 Subject: [PATCH 4/7] [IMP] mail_partial_autodelete: add config parameter for debugmode --- mail_partial_autodelete/models/mail_mail.py | 4 ++++ .../tests/test_mail_partial_autodelete.py | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/mail_partial_autodelete/models/mail_mail.py b/mail_partial_autodelete/models/mail_mail.py index fca1523943..e55265d08c 100644 --- a/mail_partial_autodelete/models/mail_mail.py +++ b/mail_partial_autodelete/models/mail_mail.py @@ -13,6 +13,10 @@ def _send(self, auto_commit=False, raise_exception=False, smtp_session=None): def unlink(self): if self.env.context.get("autodelete_skip_unlink"): + if self.env["ir.config_parameter"].get_param( + "mail_partial_autodelete_debugmode" + ): + return self.write({"state": "sent"}) # prevent further operations return self.write({"body_html": "", "body": ""}) else: return super().unlink() diff --git a/mail_partial_autodelete/tests/test_mail_partial_autodelete.py b/mail_partial_autodelete/tests/test_mail_partial_autodelete.py index a79293deb1..e04633ede6 100644 --- a/mail_partial_autodelete/tests/test_mail_partial_autodelete.py +++ b/mail_partial_autodelete/tests/test_mail_partial_autodelete.py @@ -22,3 +22,11 @@ def test_autodelete_only_purge(self): self.mail.auto_delete = True self.mail._send() self.assertEqual(self.mail.body, "") + + def test_autodelete_only_purge_debugmode(self): + self.env["ir.config_parameter"].create( + {"key": "mail_partial_autodelete_debugmode", "value": 1} + ) + self.mail.auto_delete = True + self.mail._send() + self.assertEqual(self.mail.body, "

example body

") From 4a61cc31a2aea74d97b202d27fe1b0a6d2fbfa73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20BEAU?= Date: Sun, 2 Jan 2022 22:52:54 +0100 Subject: [PATCH 5/7] [FIX] fix autodelete of notification --- mail_partial_autodelete/models/mail_mail.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/mail_partial_autodelete/models/mail_mail.py b/mail_partial_autodelete/models/mail_mail.py index e55265d08c..397c404068 100644 --- a/mail_partial_autodelete/models/mail_mail.py +++ b/mail_partial_autodelete/models/mail_mail.py @@ -17,6 +17,14 @@ def unlink(self): "mail_partial_autodelete_debugmode" ): return self.write({"state": "sent"}) # prevent further operations - return self.write({"body_html": "", "body": ""}) + # We only want to keep a trace of sent email during a grace period + # exceptions email can be drop + sent_records = self.filtered(lambda s: s.state == "sent") + # we purge (for security reason) email that are not a notification + # maybe we have secret inside + sent_records.filtered(lambda s: not s.notification).write( + {"body_html": "", "body": ""} + ) + return super(MailMail, self - sent_records).unlink() else: return super().unlink() From ab02fb71b9926d6b5581ed9e0fd57c9172adc29c Mon Sep 17 00:00:00 2001 From: Mathieu Date: Wed, 19 Nov 2025 14:34:59 +0100 Subject: [PATCH 6/7] [IMP] mail_partial_autodelete: pre-commit auto fixes --- mail_partial_autodelete/README.rst | 87 +++- mail_partial_autodelete/pyproject.toml | 3 + .../readme/CONTRIBUTORS.md | 2 + .../readme/CONTRIBUTORS.rst | 2 - mail_partial_autodelete/readme/DESCRIPTION.md | 4 + .../readme/DESCRIPTION.rst | 4 - .../readme/{USAGE.rst => USAGE.md} | 3 +- .../static/description/index.html | 433 ++++++++++++++++++ 8 files changed, 530 insertions(+), 8 deletions(-) create mode 100644 mail_partial_autodelete/pyproject.toml create mode 100644 mail_partial_autodelete/readme/CONTRIBUTORS.md delete mode 100644 mail_partial_autodelete/readme/CONTRIBUTORS.rst create mode 100644 mail_partial_autodelete/readme/DESCRIPTION.md delete mode 100644 mail_partial_autodelete/readme/DESCRIPTION.rst rename mail_partial_autodelete/readme/{USAGE.rst => USAGE.md} (60%) create mode 100644 mail_partial_autodelete/static/description/index.html diff --git a/mail_partial_autodelete/README.rst b/mail_partial_autodelete/README.rst index 258cd5725d..78ed33b446 100644 --- a/mail_partial_autodelete/README.rst +++ b/mail_partial_autodelete/README.rst @@ -1 +1,86 @@ -todo +======================= +Mail partial autodelete +======================= + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:19fdfbe85e5244b956fbfc7a609bba1a81ba94021b8fef69f66b758aae36c309 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fsocial-lightgray.png?logo=github + :target: https://github.com/OCA/social/tree/18.0/mail_partial_autodelete + :alt: OCA/social +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/social-18-0/social-18-0-mail_partial_autodelete + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/builds?repo=OCA/social&target_branch=18.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module changes what the "autodelete" flag on emails does. These +emails' content is purged, it will not delete them after sending them. +Useful in case you want to keep track of what was sent, but don't want +to store sensitive content that was in the mail body. + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +Just install this module and if needed put context key force_autodelete +for emails you don't care about. + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us to smash it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +------- + +* Akretion + +Contributors +------------ + +- Kevin Khao +- Sébastien Beau + +Maintainers +----------- + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +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. + +This module is part of the `OCA/social `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/mail_partial_autodelete/pyproject.toml b/mail_partial_autodelete/pyproject.toml new file mode 100644 index 0000000000..4231d0cccb --- /dev/null +++ b/mail_partial_autodelete/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/mail_partial_autodelete/readme/CONTRIBUTORS.md b/mail_partial_autodelete/readme/CONTRIBUTORS.md new file mode 100644 index 0000000000..ddac853bbf --- /dev/null +++ b/mail_partial_autodelete/readme/CONTRIBUTORS.md @@ -0,0 +1,2 @@ +- Kevin Khao \ +- Sébastien Beau \ diff --git a/mail_partial_autodelete/readme/CONTRIBUTORS.rst b/mail_partial_autodelete/readme/CONTRIBUTORS.rst deleted file mode 100644 index 79f515ed4a..0000000000 --- a/mail_partial_autodelete/readme/CONTRIBUTORS.rst +++ /dev/null @@ -1,2 +0,0 @@ -* Kevin Khao -* Sébastien Beau diff --git a/mail_partial_autodelete/readme/DESCRIPTION.md b/mail_partial_autodelete/readme/DESCRIPTION.md new file mode 100644 index 0000000000..d84b5e9a25 --- /dev/null +++ b/mail_partial_autodelete/readme/DESCRIPTION.md @@ -0,0 +1,4 @@ +This module changes what the "autodelete" flag on emails does. These +emails' content is purged, it will not delete them after sending them. +Useful in case you want to keep track of what was sent, but don't want +to store sensitive content that was in the mail body. diff --git a/mail_partial_autodelete/readme/DESCRIPTION.rst b/mail_partial_autodelete/readme/DESCRIPTION.rst deleted file mode 100644 index f839d17ea8..0000000000 --- a/mail_partial_autodelete/readme/DESCRIPTION.rst +++ /dev/null @@ -1,4 +0,0 @@ -This module changes what the "autodelete" flag on emails does. These emails' content is purged, it will not delete them -after sending them. -Useful in case you want to keep track of what was sent, but don't want to store sensitive content that was in the -mail body. diff --git a/mail_partial_autodelete/readme/USAGE.rst b/mail_partial_autodelete/readme/USAGE.md similarity index 60% rename from mail_partial_autodelete/readme/USAGE.rst rename to mail_partial_autodelete/readme/USAGE.md index 855c6630fb..5d24a400d5 100644 --- a/mail_partial_autodelete/readme/USAGE.rst +++ b/mail_partial_autodelete/readme/USAGE.md @@ -1 +1,2 @@ -Just install this module and if needed put context key force_autodelete for emails you don't care about. +Just install this module and if needed put context key force_autodelete +for emails you don't care about. diff --git a/mail_partial_autodelete/static/description/index.html b/mail_partial_autodelete/static/description/index.html new file mode 100644 index 0000000000..ac1d1eb4c4 --- /dev/null +++ b/mail_partial_autodelete/static/description/index.html @@ -0,0 +1,433 @@ + + + + + +Mail partial autodelete + + + +
+

Mail partial autodelete

+ + +

Beta License: AGPL-3 OCA/social Translate me on Weblate Try me on Runboat

+

This module changes what the “autodelete” flag on emails does. These +emails’ content is purged, it will not delete them after sending them. +Useful in case you want to keep track of what was sent, but don’t want +to store sensitive content that was in the mail body.

+

Table of contents

+ +
+

Usage

+

Just install this module and if needed put context key force_autodelete +for emails you don’t care about.

+
+
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us to smash it by providing a detailed and welcomed +feedback.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Akretion
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+ +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.

+

This module is part of the OCA/social project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + From 48ae47b89fea8a75fdaa06a5f30ebd2b047d1272 Mon Sep 17 00:00:00 2001 From: Mathieu Date: Wed, 19 Nov 2025 15:25:45 +0100 Subject: [PATCH 7/7] [MIG] mail_partial_autodelete: Migration to 18.0 --- mail_partial_autodelete/__manifest__.py | 2 +- mail_partial_autodelete/models/mail_mail.py | 23 +++++++++++++++---- .../tests/test_mail_partial_autodelete.py | 15 +++++++----- 3 files changed, 29 insertions(+), 11 deletions(-) diff --git a/mail_partial_autodelete/__manifest__.py b/mail_partial_autodelete/__manifest__.py index 00a8bcfb43..c0bb726db7 100644 --- a/mail_partial_autodelete/__manifest__.py +++ b/mail_partial_autodelete/__manifest__.py @@ -2,7 +2,7 @@ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). { "name": "Mail partial autodelete", - "version": "14.0.1.0.0", + "version": "18.0.1.0.0", "category": "Generic Modules", "summary": """ Add functionality to automatically purge body of emails """, "author": "Akretion,Odoo Community Association (OCA)", diff --git a/mail_partial_autodelete/models/mail_mail.py b/mail_partial_autodelete/models/mail_mail.py index 397c404068..8a316954ad 100644 --- a/mail_partial_autodelete/models/mail_mail.py +++ b/mail_partial_autodelete/models/mail_mail.py @@ -7,9 +7,24 @@ class MailMail(models.Model): _inherit = "mail.mail" - def _send(self, auto_commit=False, raise_exception=False, smtp_session=None): + def _send( + self, + auto_commit=False, + raise_exception=False, + smtp_session=None, + alias_domain_id=False, + mail_server=False, + post_send_callback=None, + ): self = self.with_context(autodelete_skip_unlink=True) - return super()._send(auto_commit, raise_exception, smtp_session) + return super()._send( + auto_commit, + raise_exception, + smtp_session, + alias_domain_id, + mail_server, + post_send_callback, + ) def unlink(self): if self.env.context.get("autodelete_skip_unlink"): @@ -22,8 +37,8 @@ def unlink(self): sent_records = self.filtered(lambda s: s.state == "sent") # we purge (for security reason) email that are not a notification # maybe we have secret inside - sent_records.filtered(lambda s: not s.notification).write( - {"body_html": "", "body": ""} + sent_records.filtered(lambda s: not s.is_notification).write( + {"body_html": ""} ) return super(MailMail, self - sent_records).unlink() else: diff --git a/mail_partial_autodelete/tests/test_mail_partial_autodelete.py b/mail_partial_autodelete/tests/test_mail_partial_autodelete.py index e04633ede6..ae7ae232d0 100644 --- a/mail_partial_autodelete/tests/test_mail_partial_autodelete.py +++ b/mail_partial_autodelete/tests/test_mail_partial_autodelete.py @@ -1,27 +1,30 @@ # Copyright 2021 Akretion (http://www.akretion.com) # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). -from odoo.tests import SavepointCase +from odoo.addons.base.tests.common import BaseCommon -class TestMailPartialAutodeleteCase(SavepointCase): +class TestStockMoveForcedLot(BaseCommon): def setUp(self): super().setUp() self.mail = self.env["mail.mail"].create( { - "body": "example body", + "subject": "Test subject", + "body_html": "example body", + "email_to": "test@example.com", + "email_from": self.env.user.email, } ) def test_no_autodelete(self): self.mail.auto_delete = False self.mail._send() - self.assertEqual(self.mail.body, "

example body

") + self.assertEqual(self.mail.body_html, "example body") def test_autodelete_only_purge(self): self.mail.auto_delete = True self.mail._send() - self.assertEqual(self.mail.body, "") + self.assertEqual(self.mail.body_html, "") def test_autodelete_only_purge_debugmode(self): self.env["ir.config_parameter"].create( @@ -29,4 +32,4 @@ def test_autodelete_only_purge_debugmode(self): ) self.mail.auto_delete = True self.mail._send() - self.assertEqual(self.mail.body, "

example body

") + self.assertEqual(self.mail.body_html, "example body")