Added Upstream Patch for mail
This commit is contained in:
parent
5e19179427
commit
b851be6ef5
@ -131,16 +131,19 @@ class MailMail(models.Model):
|
||||
messages to send (by default all 'outgoing'
|
||||
messages are sent).
|
||||
"""
|
||||
if not self.ids:
|
||||
filters = ['&',
|
||||
('state', '=', 'outgoing'),
|
||||
'|',
|
||||
('scheduled_date', '<', datetime.datetime.now()),
|
||||
('scheduled_date', '=', False)]
|
||||
if 'filters' in self._context:
|
||||
filters.extend(self._context['filters'])
|
||||
# TODO: make limit configurable
|
||||
ids = self.search(filters, limit=10000).ids
|
||||
filters = ['&',
|
||||
('state', '=', 'outgoing'),
|
||||
'|',
|
||||
('scheduled_date', '<', datetime.datetime.now()),
|
||||
('scheduled_date', '=', False)]
|
||||
if 'filters' in self._context:
|
||||
filters.extend(self._context['filters'])
|
||||
# TODO: make limit configurable
|
||||
filtered_ids = self.search(filters, limit=10000).ids
|
||||
if not ids:
|
||||
ids = filtered_ids
|
||||
else:
|
||||
ids = list(set(filtered_ids) & set(ids))
|
||||
res = None
|
||||
try:
|
||||
# auto-commit except in testing mode
|
||||
|
@ -1732,6 +1732,8 @@ class MailThread(models.AbstractModel):
|
||||
continue
|
||||
if isinstance(content, pycompat.text_type):
|
||||
content = content.encode('utf-8')
|
||||
elif content is None:
|
||||
continue
|
||||
data_attach = {
|
||||
'name': name,
|
||||
'datas': base64.b64encode(content),
|
||||
@ -1757,7 +1759,7 @@ class MailThread(models.AbstractModel):
|
||||
if not attachment:
|
||||
attachment = fname_mapping.get(node.get('data-filename'), '')
|
||||
if attachment:
|
||||
node.set('src', '/web/image/%s' % attachment.id)
|
||||
node.set('src', '/web/image/%s?access_token=%s' % (attachment.id, attachment.access_token))
|
||||
postprocessed = True
|
||||
if postprocessed:
|
||||
body = lxml.html.tostring(root, pretty_print=False, encoding='UTF-8')
|
||||
|
@ -20,7 +20,7 @@
|
||||
invisible="not context.get('mail_invite_follower_channel_only')"
|
||||
options="{'no_create': True}"/>
|
||||
<field name="send_mail" invisible="context.get('mail_invite_follower_channel_only')"/>
|
||||
<field name="message" attrs="{'invisible': [('send_mail','!=',True)]}" options="{'style-inline': true}" class="test_message"/>
|
||||
<field name="message" attrs="{'invisible': [('send_mail','!=',True)]}" options="{'style-inline': true, 'no-attachment': true}" class="test_message"/>
|
||||
</group>
|
||||
<footer>
|
||||
<button string="Add Followers"
|
||||
|
Loading…
Reference in New Issue
Block a user