mirror of
https://gitlab.com/flectra-hq/flectra.git
synced 2026-11-03 04:40:20 -06:00
[PATCH] Upstream patch - 03092023
This commit is contained in:
1 parent
9c55d405d7
commit
6124094c94
42 files changed
+1191
-176
No files matched your search
@@ -1,7 +1,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo, Flectra. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from flectra import api, fields, models
|
||||
from flectra import api, fields, models, tools
|
||||
from flectra.osv import expression
|
||||
|
||||
|
||||
@@ -162,9 +162,10 @@ class MassMailingContact(models.Model):
|
||||
return contact.name_get()[0]
|
||||
|
||||
def _message_get_default_recipients(self):
|
||||
return {r.id: {
|
||||
'partner_ids': [],
|
||||
'email_to': r.email_normalized,
|
||||
'email_cc': False}
|
||||
for r in self
|
||||
return {
|
||||
r.id: {
|
||||
'partner_ids': [],
|
||||
'email_to': ','.join(tools.email_normalize_all(r.email)) or r.email,
|
||||
'email_cc': False,
|
||||
} for r in self
|
||||
}
|
||||
@@ -48,6 +48,8 @@ class MassMailCase(MailCase, MockLinkTracker):
|
||||
'record: linked record,
|
||||
# MAIL.MAIL
|
||||
'content': optional content that should be present in mail.mail body_html;
|
||||
'email_to_mail': optional email used for the mail, when different from the
|
||||
one stored on the trace itself;
|
||||
'email_to_recipients': optional, see '_assertMailMail';
|
||||
'failure_type': optional failure reason;
|
||||
}, { ... }]
|
||||
@@ -97,6 +99,7 @@ class MassMailCase(MailCase, MockLinkTracker):
|
||||
for recipient_info, link_info, record in zip(recipients_info, mail_links_info, records):
|
||||
partner = recipient_info.get('partner', self.env['res.partner'])
|
||||
email = recipient_info.get('email')
|
||||
email_to_mail = recipient_info.get('email_to_mail') or email
|
||||
email_to_recipients = recipient_info.get('email_to_recipients')
|
||||
state = recipient_info.get('state', 'sent')
|
||||
record = record or recipient_info.get('record')
|
||||
@@ -150,7 +153,7 @@ class MassMailCase(MailCase, MockLinkTracker):
|
||||
)
|
||||
else:
|
||||
self.assertMailMailWEmails(
|
||||
[email], state_mapping[state],
|
||||
[email_to_mail], state_mapping[state],
|
||||
author=author,
|
||||
content=content,
|
||||
email_to_recipients=email_to_recipients,
|
||||
|
||||
@@ -60,12 +60,12 @@ class MailComposeMessage(models.TransientModel):
|
||||
for res_id in res_ids:
|
||||
mail_values = res[res_id]
|
||||
if mail_values.get('email_to'):
|
||||
mail_to = tools.email_normalize(mail_values['email_to'])
|
||||
mail_to = tools.email_normalize(mail_values['email_to'], force_single=False)
|
||||
else:
|
||||
partner_id = (mail_values.get('recipient_ids') or [(False, '')])[0][1]
|
||||
mail_to = tools.email_normalize(partners_email.get(partner_id))
|
||||
mail_to = tools.email_normalize(partners_email.get(partner_id), force_single=False)
|
||||
if (opt_out_list and mail_to in opt_out_list) or (seen_list and mail_to in seen_list) \
|
||||
or (not mail_to or not email_re.findall(mail_to)):
|
||||
or not mail_to:
|
||||
# prevent sending to blocked addresses that were included by mistake
|
||||
mail_values['state'] = 'cancel'
|
||||
elif seen_list is not None:
|
||||
|
||||
Reference in new issue
Block a user