diff options
Diffstat (limited to 'addons/mail/mail_mail.py')
| -rw-r--r-- | addons/mail/mail_mail.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/addons/mail/mail_mail.py b/addons/mail/mail_mail.py index 0a6a250bcaa..aeea2c0b1a5 100644 --- a/addons/mail/mail_mail.py +++ b/addons/mail/mail_mail.py @@ -24,7 +24,7 @@ import logging import re from urlparse import urljoin -from openerp import tools +from openerp import api, tools from openerp import SUPERUSER_ID from openerp.addons.base.ir.ir_mail_server import MailDeliveryException from openerp.osv import fields, osv @@ -51,7 +51,7 @@ class mail_mail(osv.Model): ('received', 'Received'), ('exception', 'Delivery Failed'), ('cancel', 'Cancelled'), - ], 'Status', readonly=True), + ], 'Status', readonly=True, copy=False), 'auto_delete': fields.boolean('Auto Delete', help="Permanently delete this email after sending it, to save space"), 'references': fields.text('References', help='Message references, such as identifiers of previous messages', readonly=1), @@ -59,7 +59,7 @@ class mail_mail(osv.Model): 'recipient_ids': fields.many2many('res.partner', string='To (Partners)'), 'email_cc': fields.char('Cc', help='Carbon copy message recipients'), 'body_html': fields.text('Rich-text Contents', help="Rich-text/HTML message"), - 'headers': fields.text('Headers'), + 'headers': fields.text('Headers', copy=False), # Auto-detected based on create() - if 'mail_message_id' was passed then this mail is a notification # and during unlink() we will not cascade delete the parent and its attachments 'notification': fields.boolean('Is Notification', @@ -98,6 +98,7 @@ class mail_mail(osv.Model): def cancel(self, cr, uid, ids, context=None): return self.write(cr, uid, ids, {'state': 'cancel'}, context=context) + @api.cr_uid def process_email_queue(self, cr, uid, ids=None, context=None): """Send immediately queued messages, committing after each message is sent - this is not transactional and should @@ -226,8 +227,7 @@ class mail_mail(osv.Model): email sending process has failed :return: True """ - if context is None: - context = {} + context = dict(context or {}) ir_mail_server = self.pool.get('ir.mail_server') ir_attachment = self.pool['ir.attachment'] for mail in self.browse(cr, SUPERUSER_ID, ids, context=context): @@ -301,8 +301,9 @@ class mail_mail(osv.Model): # /!\ can't use mail.state here, as mail.refresh() will cause an error # see revid:odo@openerp.com-20120622152536-42b2s28lvdv3odyr in 6.1 + if mail_sent: + _logger.info('Mail with ID %r and Message-Id %r successfully sent', mail.id, mail.message_id) self._postprocess_sent_message(cr, uid, mail, context=context, mail_sent=mail_sent) - _logger.info('Mail with ID %r and Message-Id %r successfully sent', mail.id, mail.message_id) except MemoryError: # prevent catching transient MemoryErrors, bubble up to notify user or abort cron job # instead of marking the mail as failed |
