odoo/odoo#263139

Created by fw-bot
Merged at 5557b8b1f1a175129bc8d3b8fa9fe9e92bf0e156

Statuses:

label
odoo-dev:saas-19.2-17.0-opw-6168632-mass_mailing_unlink_test_mail_message-defl-524045-fw
head
03f829635e81e3e7fb352d7d37085e02cd974545
merged
4 days ago by Florentin Delcourt (defl)
odoo/odoo
17.0 #262152
18.0 #262834
saas-18.2 #262881
saas-18.3 #262964
saas-18.4 #262985
19.0 #263023
saas-19.1 #263104
saas-19.2 #263139
saas-19.3 #264807
master #264819

[FIX] mass_mailing: unlink mail.message of test mails

Steps to reproduce:
- Go to Email Marketing app
- Create a mailing campaign
- Set its recipients to Contact
- Upload a file in Settings > Attach a file
- Click on the test button to send a test mail to any mail
- Go to the first contact record
- Related attachment appears in the chatter

Issue:
Before 18.2, messages created for testing were ignored by the Chatter as they were empty (and not unlinked).

But if an attachment was provided, it was linked to the test message and not deleted afterwards (which means it shows up in the record chatter).

Fix:
Ensure the related messages are unlinked at the same time as the test mail in send_mail_test by setting is_notification to False to trigger the unlink logic and remove the related attachments at the same time.

backport of: 526b3d73886558315f2435714b2ed82fec313e78

opw-6168632

Forward-Port-Of: #262152