From 2d5260e11bd0fce29312f900c1934f98553bd3fd Mon Sep 17 00:00:00 2001 From: ryv-odoo Date: Mon, 30 Sep 2019 09:37:11 +0000 Subject: [PATCH] [FIX] sms - mass_mailing(_sms) : small fixes - In the mail/sms marketing, when we send a mass mailing (sms or not) with the mailing list selected, all the mailing list is take in account, domain is not correctly modify. Fix the onchange function. TASK_ID : 2075733 --- addons/mass_mailing/models/mailing.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/addons/mass_mailing/models/mailing.py b/addons/mass_mailing/models/mailing.py index 1da973c73dc..15c30ad52a0 100644 --- a/addons/mass_mailing/models/mailing.py +++ b/addons/mass_mailing/models/mailing.py @@ -197,23 +197,21 @@ class MassMailing(models.Model): else: mass_mailing.next_departure = cron_time - @api.onchange('mailing_model_real', 'contact_list_ids') + @api.onchange('mailing_model_name', 'contact_list_ids') def _onchange_model_and_list(self): mailing_domain = literal_eval(self.mailing_domain) if self.mailing_domain else [] - if self.mailing_model_real: + if self.mailing_model_name: if mailing_domain: try: - self.env[self.mailing_model_real].search(mailing_domain, limit=1) + self.env[self.mailing_model_name].search(mailing_domain, limit=1) except: mailing_domain = [] if not mailing_domain: - if self.mailing_model_real == 'mailing.list' and self.contact_list_ids: + if self.mailing_model_name == 'mailing.list' and self.contact_list_ids: mailing_domain = [('list_ids', 'in', self.contact_list_ids.ids)] - elif self.mailing_model_real == 'res.partner' and 'customer_rank' in self.env['res.partner']._fields: - mailing_domain = [('customer_rank', '>', 0)] - elif 'is_blacklisted' in self.env[self.mailing_model_real]._fields and not self.mailing_domain: + elif 'is_blacklisted' in self.env[self.mailing_model_name]._fields and not self.mailing_domain: mailing_domain = [('is_blacklisted', '=', False)] - elif 'opt_out' in self.env[self.mailing_model_real]._fields and not self.mailing_domain: + elif 'opt_out' in self.env[self.mailing_model_name]._fields and not self.mailing_domain: mailing_domain = [('opt_out', '=', False)] else: mailing_domain = []