From c3b49b3a5fec204a62c4a6741c6e7bf71c1bee55 Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Mon, 19 Mar 2018 15:23:47 +0100 Subject: [PATCH] [FIX] mass_mailing: domain translation As Admin: - Set up 2 languages for the installation, e.g. English and French - Admin language is English, Demo language is French - Create a `res.partner.category` named 'Test English' - Assign the category to a newly created partner - Create a French translation for 'Test English', e.g. 'Test Francais' As Demo: - Create a Mass Mailing - Select a custom domain: ('category_id', '=', 'Test Francais') => it should match one partner - Save and validate Now either: - manually run the scheduled action "Process Mass Mailing Queue" as Admin - wait for the cron to process the mass mailing No mail will be sent since the domain will be evaluated in the Admin language, i.e. English. Indeed, the domain `('category_id', '=', 'Test Francais')` does not match any record in English. The solution/workaround is to use the language of the last user who wrote ont the mass mailing. Closes #20906, Closes #15467, Closes #15445 opw-778922 --- addons/mass_mailing/models/mass_mailing.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/mass_mailing/models/mass_mailing.py b/addons/mass_mailing/models/mass_mailing.py index db828aa1b75..463d1dc7df2 100644 --- a/addons/mass_mailing/models/mass_mailing.py +++ b/addons/mass_mailing/models/mass_mailing.py @@ -611,6 +611,8 @@ class MassMailing(models.Model): def _process_mass_mailing_queue(self): mass_mailings = self.search([('state', 'in', ('in_queue', 'sending')), '|', ('schedule_date', '<', fields.Datetime.now()), ('schedule_date', '=', False)]) for mass_mailing in mass_mailings: + user = mass_mailing.write_uid or self.env.user + mass_mailing = mass_mailing.with_context(**user.sudo(user=user).context_get()) if len(mass_mailing.get_remaining_recipients()) > 0: mass_mailing.state = 'sending' mass_mailing.send_mail()